43 lines
No EOL
3.4 KiB
Text
43 lines
No EOL
3.4 KiB
Text
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(3,9): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
|
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
|
|
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 TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
|
!!! error TS2453: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
|
|
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'. |