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

138 lines
7.6 KiB
Plaintext
Raw Normal View History

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