28 lines
No EOL
620 B
Text
28 lines
No EOL
620 B
Text
==== tests/cases/compiler/stringIndexerAssignments2.ts (2 errors) ====
|
|
class C1 {
|
|
[index: string]: string
|
|
one: string;
|
|
}
|
|
|
|
class C2 {
|
|
one: string;
|
|
}
|
|
|
|
class C3 {
|
|
one: number;
|
|
two: string;
|
|
}
|
|
|
|
var x: C1;
|
|
var a: C2;
|
|
var b: C3;
|
|
|
|
x = a;
|
|
~
|
|
!!! Type 'C2' is not assignable to type 'C1':
|
|
!!! Index signature is missing in type 'C2'.
|
|
x = b;
|
|
~
|
|
!!! Type 'C3' is not assignable to type 'C1':
|
|
!!! Types of property 'one' are incompatible:
|
|
!!! Type 'number' is not assignable to type 'string'. |