21 lines
1.3 KiB
Plaintext
21 lines
1.3 KiB
Plaintext
==== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts (6 errors) ====
|
|
// array type cannot use typeof.
|
|
|
|
var x = 1;
|
|
var xs: typeof x[]; // Not an error. This is equivalent to Array<typeof x>
|
|
var xs2: typeof Array;
|
|
var xs3: typeof Array<number>;
|
|
~
|
|
!!! error TS1005: '=' expected.
|
|
~
|
|
!!! error TS1109: Expression expected.
|
|
~~~
|
|
!!! error TS2322: Type 'number' is not assignable to type '{ (arrayLength?: number): any[]; <T>(arrayLength: number): T[]; <T>(...items: T[]): T[]; new (arrayLength?: number): any[]; new <T>(arrayLength: number): T[]; new <T>(...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }':
|
|
!!! error TS2322: Property 'isArray' is missing in type 'Number'.
|
|
var xs4: typeof Array<typeof x>;
|
|
~
|
|
!!! error TS1005: '=' expected.
|
|
~
|
|
!!! error TS1109: Expression expected.
|
|
~~~
|
|
!!! error TS2323: Type 'number' is not assignable to type '{ (arrayLength?: number): any[]; <T>(arrayLength: number): T[]; <T>(...items: T[]): T[]; new (arrayLength?: number): any[]; new <T>(arrayLength: number): T[]; new <T>(...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }'. |