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

39 lines
1.3 KiB
Plaintext
Raw Normal View History

2014-11-05 21:26:03 +01:00
tests/cases/compiler/arrayAssignmentTest4.ts(24,1): error TS2322: Type '() => any' is not assignable to type 'any[]'.
Property 'push' is missing in type '() => any'.
2014-11-05 21:26:03 +01:00
tests/cases/compiler/arrayAssignmentTest4.ts(25,1): error TS2322: Type 'C3' is not assignable to type 'any[]'.
Property 'length' is missing in type 'C3'.
2014-07-13 01:04:16 +02:00
==== tests/cases/compiler/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
~~~~~~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type '() => any' is not assignable to type 'any[]'.
!!! error TS2322: Property 'push' is missing in type '() => any'.
2014-07-13 01:04:16 +02:00
arr_any = c3; // should be an error - is
~~~~~~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'C3' is not assignable to type 'any[]'.
!!! error TS2322: Property 'length' is missing in type 'C3'.
2014-07-13 01:04:16 +02:00