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

138 lines
7.6 KiB
Text
Raw Normal View History

tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2323: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2323: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2323: 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 TS2323: Type 'number' is not assignable to type 'void'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(40,5): error TS2323: 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 TS2323: 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 TS2323: 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 TS2323: 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 TS2323: 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 TS2323: 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 TS2323: 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 TS2323: 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 TS2323: 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 TS2323: Type 'A' is not assignable to type 'A'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2323: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'.
Type 'boolean' is not assignable to type 'string'.
2014-07-13 01:04:16 +02:00
==== 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 TS2323: Type 'string' is not assignable to type 'number'.
2014-07-13 01:04:16 +02:00
var aString: string = 9.9;
~~~~~~~
!!! error TS2323: Type 'number' is not assignable to type 'string'.
2014-07-13 01:04:16 +02:00
var aDate: Date = 9.9;
~~~~~
!!! error TS2323: Type 'number' is not assignable to type 'Date'.
!!! error TS2323: Property 'toDateString' is missing in type 'Number'.
2014-07-13 01:04:16 +02:00
var aVoid: void = 9.9;
~~~~~
!!! error TS2323: Type 'number' is not assignable to type 'void'.
2014-07-13 01:04:16 +02:00
var anInterface: I = new D();
~~~~~~~~~~~
!!! error TS2323: Type 'D<{}>' is not assignable to type 'I'.
!!! error TS2323: Property 'id' is missing in type 'D<{}>'.
2014-07-13 01:04:16 +02:00
var aClass: C = new D();
~~~~~~
!!! error TS2323: Type 'D<{}>' is not assignable to type 'C'.
!!! error TS2323: Property 'id' is missing in type 'D<{}>'.
2014-07-13 01:04:16 +02:00
var aGenericClass: D<string> = new C();
~~~~~~~~~~~~~
!!! error TS2323: Type 'C' is not assignable to type 'D<string>'.
!!! error TS2323: Property 'source' is missing in type 'C'.
2014-07-13 01:04:16 +02:00
var anObjectLiteral: I = { id: 'a string' };
~~~~~~~~~~~~~~~
!!! error TS2323: Type '{ id: string; }' is not assignable to type 'I'.
!!! error TS2323: Types of property 'id' are incompatible.
!!! error TS2323: Type 'string' is not assignable to type 'number'.
2014-07-13 01:04:16 +02:00
var anOtherObjectLiteral: { id: string } = new C();
~~~~~~~~~~~~~~~~~~~~
!!! error TS2323: Type 'C' is not assignable to type '{ id: string; }'.
!!! error TS2323: Types of property 'id' are incompatible.
!!! error TS2323: Type 'number' is not assignable to type 'string'.
2014-07-13 01:04:16 +02:00
var aFunction: typeof F = F2;
~~~~~~~~~
!!! error TS2323: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
!!! error TS2323: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2323: Type 'number' is not assignable to type 'string'.
2014-07-13 01:04:16 +02:00
var anOtherFunction: (x: string) => number = F2;
~~~~~~~~~~~~~~~
!!! error TS2323: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
!!! error TS2323: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2323: Type 'number' is not assignable to type 'string'.
2014-07-13 01:04:16 +02:00
var aLambda: typeof F = (x) => 'a string';
~~~~~~~
!!! error TS2323: Type '(x: string) => string' is not assignable to type '(x: string) => number'.
!!! error TS2323: Type 'string' is not assignable to type 'number'.
2014-07-13 01:04:16 +02:00
var aModule: typeof M = N;
~~~~~~~
!!! error TS2323: Type 'typeof N' is not assignable to type 'typeof M'.
!!! error TS2323: Types of property 'A' are incompatible.
!!! error TS2323: Type 'typeof A' is not assignable to type 'typeof A'.
!!! error TS2323: Type 'A' is not assignable to type 'A'.
!!! error TS2323: Property 'name' is missing in type 'A'.
2014-07-13 01:04:16 +02:00
var aClassInModule: M.A = new N.A();
~~~~~~~~~~~~~~
!!! error TS2323: Type 'A' is not assignable to type 'A'.
2014-07-13 01:04:16 +02:00
var aFunctionInModule: typeof M.F2 = F2;
~~~~~~~~~~~~~~~~~
!!! error TS2323: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'.
!!! error TS2323: Type 'boolean' is not assignable to type 'string'.
2014-07-13 01:04:16 +02:00