1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
tests/cases/compiler/assignmentIndexedToPrimitives.ts(1,7): error TS2322: Type 'number[]' is not assignable to type 'number'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(2,7): error TS2322: Type 'string[]' is not assignable to type 'number'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(3,7): error TS2322: Type '(string | number)[]' is not assignable to type 'number'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(4,7): error TS2322: Type 'number[]' is not assignable to type '0'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(6,7): error TS2322: Type 'number[]' is not assignable to type 'string'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(7,7): error TS2322: Type 'string[]' is not assignable to type 'string'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(8,7): error TS2322: Type '(string | number)[]' is not assignable to type 'string'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(9,7): error TS2322: Type 'string[]' is not assignable to type '"01"'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(11,7): error TS2322: Type '{ 0: number; }' is not assignable to type 'number'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(13,7): error TS2322: Type '{ 0: number; }' is not assignable to type 'string'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(14,7): error TS2322: Type '{ "0": number; }' is not assignable to type 'string'.
tests/cases/compiler/assignmentIndexedToPrimitives.ts(15,7): error TS2322: Type '{ 0: string; }' is not assignable to type 'string'.
==== tests/cases/compiler/assignmentIndexedToPrimitives.ts (12 errors) ====
const n1: number = [0];
~~
!!! error TS2322: Type 'number[]' is not assignable to type 'number'.
const n2: number = ["0"];
~~
!!! error TS2322: Type 'string[]' is not assignable to type 'number'.
const n3: number = [0, "1"];
~~
!!! error TS2322: Type '(string | number)[]' is not assignable to type 'number'.
const n4: 0 = [0];
~~
!!! error TS2322: Type 'number[]' is not assignable to type '0'.
const s1: string = [0];
~~
!!! error TS2322: Type 'number[]' is not assignable to type 'string'.
const s2: string = ["0"];
~~
!!! error TS2322: Type 'string[]' is not assignable to type 'string'.
const s3: string = [0, "1"];
~~
!!! error TS2322: Type '(string | number)[]' is not assignable to type 'string'.
const s4: "01" = ["0", "1"];
~~
!!! error TS2322: Type 'string[]' is not assignable to type '"01"'.
const no1: number = { 0: 1 };
~~~
!!! error TS2322: Type '{ 0: number; }' is not assignable to type 'number'.
const so1: string = { 0: 1 };
~~~
!!! error TS2322: Type '{ 0: number; }' is not assignable to type 'string'.
const so2: string = { "0": 1 };
~~~
!!! error TS2322: Type '{ "0": number; }' is not assignable to type 'string'.
const so3: string = { 0: "1" };
~~~
!!! error TS2322: Type '{ 0: string; }' is not assignable to type 'string'.
|