138 lines
No EOL
7.6 KiB
Text
138 lines
No EOL
7.6 KiB
Text
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type 'number' is not assignable to type 'Date'.
|
|
Property 'toDateString' is missing in type 'Number'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(38,5): error TS2322: Type 'number' is not assignable to type 'void'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(40,5): error TS2322: Type 'D<{}>' is not assignable to type 'I'.
|
|
Property 'id' is missing in type 'D<{}>'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(41,5): error TS2322: Type 'D<{}>' is not assignable to type 'C'.
|
|
Property 'id' is missing in type 'D<{}>'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(42,5): error TS2322: Type 'C' is not assignable to type 'D<string>'.
|
|
Property 'source' is missing in type 'C'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(43,5): error TS2322: Type '{ id: string; }' is not assignable to type 'I'.
|
|
Types of property 'id' are incompatible.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(44,5): error TS2322: Type 'C' is not assignable to type '{ id: string; }'.
|
|
Types of property 'id' are incompatible.
|
|
Type 'number' is not assignable to type 'string'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(46,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
|
|
Types of parameters 'x' and 'x' are incompatible.
|
|
Type 'number' is not assignable to type 'string'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(47,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
|
|
Types of parameters 'x' and 'x' are incompatible.
|
|
Type 'number' is not assignable to type 'string'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(48,5): error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number'.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(50,5): error TS2322: Type 'typeof N' is not assignable to type 'typeof M'.
|
|
Types of property 'A' are incompatible.
|
|
Type 'typeof A' is not assignable to type 'typeof A'.
|
|
Type 'A' is not assignable to type 'A'.
|
|
Property 'name' is missing in type 'A'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(51,5): error TS2322: Type 'A' is not assignable to type 'A'.
|
|
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'.
|
|
Type 'boolean' is not assignable to type 'string'.
|
|
|
|
|
|
==== tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts (15 errors) ====
|
|
interface I {
|
|
id: number;
|
|
}
|
|
|
|
class C implements I {
|
|
id: number;
|
|
}
|
|
|
|
class D<T>{
|
|
source: T;
|
|
recurse: D<T>;
|
|
wrapped: D<D<T>>
|
|
}
|
|
|
|
function F(x: string): number { return 42; }
|
|
function F2(x: number): boolean { return x < 42; }
|
|
|
|
module M {
|
|
export class A {
|
|
name: string;
|
|
}
|
|
|
|
export function F2(x: number): string { return x.toString(); }
|
|
}
|
|
|
|
module N {
|
|
export class A {
|
|
id: number;
|
|
}
|
|
|
|
export function F2(x: number): string { return x.toString(); }
|
|
}
|
|
|
|
var aNumber: number = 'this is a string';
|
|
~~~~~~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
var aString: string = 9.9;
|
|
~~~~~~~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
|
var aDate: Date = 9.9;
|
|
~~~~~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'Date'.
|
|
!!! error TS2322: Property 'toDateString' is missing in type 'Number'.
|
|
|
|
var aVoid: void = 9.9;
|
|
~~~~~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'void'.
|
|
|
|
var anInterface: I = new D();
|
|
~~~~~~~~~~~
|
|
!!! error TS2322: Type 'D<{}>' is not assignable to type 'I'.
|
|
!!! error TS2322: Property 'id' is missing in type 'D<{}>'.
|
|
var aClass: C = new D();
|
|
~~~~~~
|
|
!!! error TS2322: Type 'D<{}>' is not assignable to type 'C'.
|
|
!!! error TS2322: Property 'id' is missing in type 'D<{}>'.
|
|
var aGenericClass: D<string> = new C();
|
|
~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'C' is not assignable to type 'D<string>'.
|
|
!!! error TS2322: Property 'source' is missing in type 'C'.
|
|
var anObjectLiteral: I = { id: 'a string' };
|
|
~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '{ id: string; }' is not assignable to type 'I'.
|
|
!!! error TS2322: Types of property 'id' are incompatible.
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
var anOtherObjectLiteral: { id: string } = new C();
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'C' is not assignable to type '{ id: string; }'.
|
|
!!! error TS2322: Types of property 'id' are incompatible.
|
|
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
|
|
|
var aFunction: typeof F = F2;
|
|
~~~~~~~~~
|
|
!!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
|
|
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
|
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
|
var anOtherFunction: (x: string) => number = F2;
|
|
~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
|
|
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
|
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
|
var aLambda: typeof F = (x) => 'a string';
|
|
~~~~~~~
|
|
!!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number'.
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
|
|
var aModule: typeof M = N;
|
|
~~~~~~~
|
|
!!! error TS2322: Type 'typeof N' is not assignable to type 'typeof M'.
|
|
!!! error TS2322: Types of property 'A' are incompatible.
|
|
!!! error TS2322: Type 'typeof A' is not assignable to type 'typeof A'.
|
|
!!! error TS2322: Type 'A' is not assignable to type 'A'.
|
|
!!! error TS2322: Property 'name' is missing in type 'A'.
|
|
var aClassInModule: M.A = new N.A();
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'A' is not assignable to type 'A'.
|
|
var aFunctionInModule: typeof M.F2 = F2;
|
|
~~~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'.
|
|
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
|
|
|
|