mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
33 lines
1.1 KiB
Plaintext
33 lines
1.1 KiB
Plaintext
arrayAssignmentTest4.ts(22,1): error TS2322: Type '() => any' is not assignable to type 'any[]'.
|
|
arrayAssignmentTest4.ts(23,1): error TS2740: Type 'C3' is missing the following properties from type 'any[]': length, pop, push, concat, and 25 more.
|
|
|
|
|
|
==== arrayAssignmentTest4.ts (2 errors) ====
|
|
class C3 {
|
|
CM3M1() { return 3;}
|
|
}
|
|
|
|
|
|
/*
|
|
|
|
This behaves unexpectedly with teh following types:
|
|
|
|
Type 1 of any[]:
|
|
|
|
* Type 2 of the following throws an error but shouldn't: () => void[], SomeClass[], and {one: 1}[].
|
|
|
|
* Type 2 of the following doesn't throw an error but should: {one: 1}, new() => SomeClass, SomeClass.
|
|
|
|
*/
|
|
var c3 : C3 = new C3();
|
|
var o1 = {one : 1};
|
|
|
|
var arr_any: any[] = [];
|
|
|
|
arr_any = function () { return null;} // should be an error - is
|
|
~~~~~~~
|
|
!!! error TS2322: Type '() => any' is not assignable to type 'any[]'.
|
|
arr_any = c3; // should be an error - is
|
|
~~~~~~~
|
|
!!! error TS2740: Type 'C3' is missing the following properties from type 'any[]': length, pop, push, concat, and 25 more.
|
|
|