TypeScript/tests/baselines/reference/propertiesAndIndexers.errors.txt

90 lines
2.8 KiB
Plaintext

==== tests/cases/compiler/propertiesAndIndexers.ts (19 errors) ====
interface X { }
interface Y {
n: number;
}
interface Z {
s: string;
}
interface A {
a: Y;
b: X;
1: Z;
}
interface B extends A {
[n: number]: string;
~~~~~~~~~~~~~~~~~~~~
!!! Property '1' of type 'Z' is not assignable to numeric index type 'string'.
c: boolean;
3: boolean;
~~~~~~~~~~~
!!! Property '3' of type 'boolean' is not assignable to numeric index type 'string'.
6(): string;
~~~~~~~~~~~~
!!! Property '6' of type '() => string' is not assignable to numeric index type 'string'.
}
interface B {
4: boolean;
~~~~~~~~~~~
!!! Property '4' of type 'boolean' is not assignable to numeric index type 'string'.
5: string;
}
interface C extends A {
[s: string]: number;
~~~~~~~~~~~~~~~~~~~~
!!! Property '1' of type 'Z' is not assignable to string index type 'number'.
~~~~~~~~~~~~~~~~~~~~
!!! Property 'a' of type 'Y' is not assignable to string index type 'number'.
~~~~~~~~~~~~~~~~~~~~
!!! Property 'b' of type 'X' is not assignable to string index type 'number'.
c: boolean;
~~~~~~~~~~~
!!! Property 'c' of type 'boolean' is not assignable to string index type 'number'.
3: boolean;
~~~~~~~~~~~
!!! Property '3' of type 'boolean' is not assignable to string index type 'number'.
}
interface D extends B, C {
~
!!! Numeric index type 'string' is not assignable to string index type 'number'.
~
!!! Property '4' of type 'boolean' is not assignable to string index type 'number'.
~
!!! Property '5' of type 'string' is not assignable to string index type 'number'.
~
!!! Property '6' of type '() => string' is not assignable to string index type 'number'.
2: Z;
~~~~~
!!! Property '2' of type 'Z' is not assignable to numeric index type 'string'.
~~~~~
!!! Property '2' of type 'Z' is not assignable to string index type 'number'.
Infinity: number;
~~~~~~~~~~~~~~~~~
!!! Property 'Infinity' of type 'number' is not assignable to numeric index type 'string'.
zoo: string;
~~~~~~~~~~~~
!!! Property 'zoo' of type 'string' is not assignable to string index type 'number'.
}
class P {
[n: string]: string
}
class Q extends P {
t: number;
~~~~~~~~~~
!!! Property 't' of type 'number' is not assignable to string index type 'string'.
}
var c: {
[n: number]: string;
c: boolean;
3: boolean;
~~~~~~~~~~~
!!! Property '3' of type 'boolean' is not assignable to numeric index type 'string'.
};