mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
29 lines
1.5 KiB
Plaintext
29 lines
1.5 KiB
Plaintext
assignmentCompat1.ts(4,1): error TS2741: Property 'one' is missing in type '{ [index: string]: any; }' but required in type '{ one: number; }'.
|
|
assignmentCompat1.ts(6,1): error TS2741: Property 'one' is missing in type '{ [index: number]: any; }' but required in type '{ one: number; }'.
|
|
assignmentCompat1.ts(8,1): error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
|
|
assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
|
|
|
|
|
|
==== assignmentCompat1.ts (4 errors) ====
|
|
var x = { one: 1 };
|
|
declare var y: { [index: string]: any };
|
|
declare var z: { [index: number]: any };
|
|
x = y; // Error
|
|
~
|
|
!!! error TS2741: Property 'one' is missing in type '{ [index: string]: any; }' but required in type '{ one: number; }'.
|
|
!!! related TS2728 assignmentCompat1.ts:1:11: 'one' is declared here.
|
|
y = x; // Ok because index signature type is any
|
|
x = z; // Error
|
|
~
|
|
!!! error TS2741: Property 'one' is missing in type '{ [index: number]: any; }' but required in type '{ one: number; }'.
|
|
!!! related TS2728 assignmentCompat1.ts:1:11: 'one' is declared here.
|
|
z = x; // Ok because index signature type is any
|
|
y = "foo"; // Error
|
|
~
|
|
!!! error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
|
|
z = "foo"; // OK, string has numeric indexer
|
|
z = false; // Error
|
|
~
|
|
!!! error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
|
|
|
|
|