41 lines
No EOL
3.1 KiB
Text
41 lines
No EOL
3.1 KiB
Text
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(3,9): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly.
|
|
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(4,22): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: number; y: number; }'.
|
|
Types of property 'y' are incompatible:
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(5,22): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: string; y: string; }'.
|
|
Types of property 'x' are incompatible:
|
|
Type 'number' is not assignable to type 'string'.
|
|
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(6,22): error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: number; y: number; }'.
|
|
Types of property 'x' are incompatible:
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(7,22): error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: string; y: string; }'.
|
|
Types of property 'y' are incompatible:
|
|
Type 'number' is not assignable to type 'string'.
|
|
|
|
|
|
==== tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts (5 errors) ====
|
|
function foo<T>(n: { x: T; y: T }, m: T) { return m; }
|
|
// these are all errors
|
|
var x = foo({ x: 3, y: "" }, 4);
|
|
~~~
|
|
!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly.
|
|
var x2 = foo<number>({ x: 3, y: "" }, 4);
|
|
~~~~~~~~~~~~~~~
|
|
!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: number; y: number; }'.
|
|
!!! error TS2345: Types of property 'y' are incompatible:
|
|
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
|
var x3 = foo<string>({ x: 3, y: "" }, 4);
|
|
~~~~~~~~~~~~~~~
|
|
!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: string; y: string; }'.
|
|
!!! error TS2345: Types of property 'x' are incompatible:
|
|
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
|
var x4 = foo<number>({ x: "", y: 4 }, "");
|
|
~~~~~~~~~~~~~~~
|
|
!!! error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: number; y: number; }'.
|
|
!!! error TS2345: Types of property 'x' are incompatible:
|
|
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
|
var x5 = foo<string>({ x: "", y: 4 }, "");
|
|
~~~~~~~~~~~~~~~
|
|
!!! error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: string; y: string; }'.
|
|
!!! error TS2345: Types of property 'y' are incompatible:
|
|
!!! error TS2345: Type 'number' is not assignable to type 'string'. |