TypeScript/tests/baselines/reference/contextualTypeWithTuple.errors.txt
Daniel Rosenwasser 6e77e2e810 Removed colons from diagnostic messages.
Also got rid of the 'terminalMessages' concept.
2014-10-28 00:48:58 -07:00

58 lines
No EOL
3.8 KiB
Text

tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS2323: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
Types of property 'pop' are incompatible.
Type '() => string | number | boolean' is not assignable to type '() => string | number'.
Type 'string | number | boolean' is not assignable to type 'string | number'.
Type 'boolean' is not assignable to type 'string | number'.
Type 'boolean' is not assignable to type 'number'.
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(8,1): error TS2323: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(11,1): error TS2323: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'.
Types of property '0' are incompatible.
Type '{}' is not assignable to type '{ a: string; }'.
Property 'a' is missing in type '{}'.
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(12,1): error TS2323: Type '[number, string]' is not assignable to type '[number, string, boolean]'.
Property '2' is missing in type '[number, string]'.
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(13,5): error TS2323: Type '[string, string, number]' is not assignable to type '[string, string]'.
Types of property 'pop' are incompatible.
Type '() => string | number' is not assignable to type '() => string'.
Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts (5 errors) ====
// no error
var numStrTuple: [number, string] = [5, "hello"];
var numStrTuple2: [number, string] = [5, "foo", true];
~~~~~~~~~~~~
!!! error TS2323: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
!!! error TS2323: Types of property 'pop' are incompatible.
!!! error TS2323: Type '() => string | number | boolean' is not assignable to type '() => string | number'.
!!! error TS2323: Type 'string | number | boolean' is not assignable to type 'string | number'.
!!! error TS2323: Type 'boolean' is not assignable to type 'string | number'.
!!! error TS2323: Type 'boolean' is not assignable to type 'number'.
var numStrBoolTuple: [number, string, boolean] = [5, "foo", true];
var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5];
var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]];
numStrTuple = numStrTuple2;
numStrTuple = numStrBoolTuple;
~~~~~~~~~~~
!!! error TS2323: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
// error
objNumTuple = [ {}, 5];
~~~~~~~~~~~
!!! error TS2323: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'.
!!! error TS2323: Types of property '0' are incompatible.
!!! error TS2323: Type '{}' is not assignable to type '{ a: string; }'.
!!! error TS2323: Property 'a' is missing in type '{}'.
numStrBoolTuple = numStrTuple;
~~~~~~~~~~~~~~~
!!! error TS2323: Type '[number, string]' is not assignable to type '[number, string, boolean]'.
!!! error TS2323: Property '2' is missing in type '[number, string]'.
var strStrTuple: [string, string] = ["foo", "bar", 5];
~~~~~~~~~~~
!!! error TS2323: Type '[string, string, number]' is not assignable to type '[string, string]'.
!!! error TS2323: Types of property 'pop' are incompatible.
!!! error TS2323: Type '() => string | number' is not assignable to type '() => string'.
!!! error TS2323: Type 'string | number' is not assignable to type 'string'.
!!! error TS2323: Type 'number' is not assignable to type 'string'.