mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Accept new baselines
This commit is contained in:
@@ -11,7 +11,7 @@ function f<T>(x: T): T { return null; }
|
||||
|
||||
var r = f(1);
|
||||
>r : number
|
||||
>f(1) : number
|
||||
>f(1) : 1
|
||||
>f : <T>(x: T) => T
|
||||
>1 : 1
|
||||
|
||||
@@ -26,7 +26,7 @@ var f2 = <T>(x: T): T => { return null; }
|
||||
|
||||
var r2 = f2(1);
|
||||
>r2 : number
|
||||
>f2(1) : number
|
||||
>f2(1) : 1
|
||||
>f2 : <T>(x: T) => T
|
||||
>1 : 1
|
||||
|
||||
@@ -39,7 +39,7 @@ var f3: { <T>(x: T): T; }
|
||||
|
||||
var r3 = f3(1);
|
||||
>r3 : number
|
||||
>f3(1) : number
|
||||
>f3(1) : 1
|
||||
>f3 : <T>(x: T) => T
|
||||
>1 : 1
|
||||
|
||||
@@ -59,7 +59,7 @@ class C {
|
||||
}
|
||||
var r4 = (new C()).f(1);
|
||||
>r4 : number
|
||||
>(new C()).f(1) : number
|
||||
>(new C()).f(1) : 1
|
||||
>(new C()).f : <T>(x: T) => T
|
||||
>(new C()) : C
|
||||
>new C() : C
|
||||
@@ -83,7 +83,7 @@ var i: I;
|
||||
|
||||
var r5 = i.f(1);
|
||||
>r5 : number
|
||||
>i.f(1) : number
|
||||
>i.f(1) : 1
|
||||
>i.f : <T>(x: T) => T
|
||||
>i : I
|
||||
>f : <T>(x: T) => T
|
||||
|
||||
@@ -54,7 +54,7 @@ function foo4<T>(x: T) {
|
||||
}
|
||||
var r4 = foo4(1);
|
||||
>r4 : number
|
||||
>foo4(1) : number
|
||||
>foo4(1) : 1
|
||||
>foo4 : <T>(x: T) => T
|
||||
>1 : 1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(2,6): error TS2339: Property 'length' does not exist on type '{}'.
|
||||
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(5,6): error TS2339: Property 'length' does not exist on type 'Object'.
|
||||
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,14): 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'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate '""'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts (3 errors) ====
|
||||
@@ -19,7 +19,7 @@ tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,14): error TS2453: The
|
||||
var result = concat(1, ""); // error
|
||||
~~~~~~
|
||||
!!! 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'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate '""'.
|
||||
var elementCount = result.length;
|
||||
|
||||
function concat2<T, U>(x: T, y: U) { return null; }
|
||||
|
||||
@@ -20,7 +20,7 @@ export default async(() => await(Promise.resolve(1)));
|
||||
>() => await(Promise.resolve(1)) : () => any
|
||||
>await(Promise.resolve(1)) : any
|
||||
>await : (...args: any[]) => any
|
||||
>Promise.resolve(1) : Promise<1>
|
||||
>Promise.resolve(1) : Promise<number>
|
||||
>Promise.resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
||||
|
||||
@@ -26,7 +26,7 @@ var a: string = x.doStuff();
|
||||
|
||||
var b: string = x.doOtherStuff('hm');
|
||||
>b : string
|
||||
>x.doOtherStuff('hm') : string
|
||||
>x.doOtherStuff('hm') : "hm"
|
||||
>x.doOtherStuff : <T>(x: T) => T
|
||||
>x : true
|
||||
>doOtherStuff : <T>(x: T) => T
|
||||
@@ -41,7 +41,7 @@ var c: string = x['doStuff']();
|
||||
|
||||
var d: string = x['doOtherStuff']('hm');
|
||||
>d : string
|
||||
>x['doOtherStuff']('hm') : string
|
||||
>x['doOtherStuff']('hm') : "hm"
|
||||
>x['doOtherStuff'] : <T>(x: T) => T
|
||||
>x : true
|
||||
>'doOtherStuff' : "doOtherStuff"
|
||||
|
||||
@@ -26,7 +26,7 @@ var a: string = x.doStuff();
|
||||
|
||||
var b: string = x.doOtherStuff('hm');
|
||||
>b : string
|
||||
>x.doOtherStuff('hm') : string
|
||||
>x.doOtherStuff('hm') : "hm"
|
||||
>x.doOtherStuff : <T>(x: T) => T
|
||||
>x : number
|
||||
>doOtherStuff : <T>(x: T) => T
|
||||
@@ -41,7 +41,7 @@ var c: string = x['doStuff']();
|
||||
|
||||
var d: string = x['doOtherStuff']('hm');
|
||||
>d : string
|
||||
>x['doOtherStuff']('hm') : string
|
||||
>x['doOtherStuff']('hm') : "hm"
|
||||
>x['doOtherStuff'] : <T>(x: T) => T
|
||||
>x : number
|
||||
>'doOtherStuff' : "doOtherStuff"
|
||||
|
||||
@@ -26,7 +26,7 @@ var a: string = x.doStuff();
|
||||
|
||||
var b: string = x.doOtherStuff('hm');
|
||||
>b : string
|
||||
>x.doOtherStuff('hm') : string
|
||||
>x.doOtherStuff('hm') : "hm"
|
||||
>x.doOtherStuff : <T>(x: T) => T
|
||||
>x : string
|
||||
>doOtherStuff : <T>(x: T) => T
|
||||
@@ -41,7 +41,7 @@ var c: string = x['doStuff']();
|
||||
|
||||
var d: string = x['doOtherStuff']('hm');
|
||||
>d : string
|
||||
>x['doOtherStuff']('hm') : string
|
||||
>x['doOtherStuff']('hm') : "hm"
|
||||
>x['doOtherStuff'] : <T>(x: T) => T
|
||||
>x : string
|
||||
>'doOtherStuff' : "doOtherStuff"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,1): 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'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate '""'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts (1 errors) ====
|
||||
@@ -7,4 +7,4 @@ tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,1): erro
|
||||
bar(1, ""); // Should be ok
|
||||
~~~
|
||||
!!! 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'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate '""'.
|
||||
@@ -139,7 +139,7 @@ var un = function () {
|
||||
// FunctionExpression with no return type annotation and returns a type parameter type
|
||||
var n = function <T>(x: T) {
|
||||
>n : number
|
||||
>function <T>(x: T) { return x;} (4) : number
|
||||
>function <T>(x: T) { return x;} (4) : 4
|
||||
>function <T>(x: T) { return x;} : <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
@@ -154,7 +154,7 @@ var n = function <T>(x: T) {
|
||||
// FunctionExpression with no return type annotation and returns a constrained type parameter type
|
||||
var n = function <T extends {}>(x: T) {
|
||||
>n : number
|
||||
>function <T extends {}>(x: T) { return x;} (4) : number
|
||||
>function <T extends {}>(x: T) { return x;} (4) : 4
|
||||
>function <T extends {}>(x: T) { return x;} : <T extends {}>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
|
||||
@@ -13,7 +13,7 @@ function foo<T>(t: T) {
|
||||
|
||||
var r = foo(''); // string
|
||||
>r : string
|
||||
>foo('') : string
|
||||
>foo('') : ""
|
||||
>foo : <T>(t: T) => T
|
||||
>'' : ""
|
||||
|
||||
@@ -47,7 +47,7 @@ function foo2b<T, U>(u: U) {
|
||||
|
||||
var r2 = foo2('', 1); // number
|
||||
>r2 : number
|
||||
>foo2('', 1) : number
|
||||
>foo2('', 1) : 1
|
||||
>foo2 : <T, U>(t: T, u: U) => U
|
||||
>'' : ""
|
||||
>1 : 1
|
||||
@@ -198,7 +198,7 @@ var r5 = c.foo2('', 1); // number
|
||||
|
||||
var r6 = c.foo3(true, 1); // boolean
|
||||
>r6 : boolean
|
||||
>c.foo3(true, 1) : boolean
|
||||
>c.foo3(true, 1) : true
|
||||
>c.foo3 : <T>(t: T, u: number) => T
|
||||
>c : C<string, number>
|
||||
>foo3 : <T>(t: T, u: number) => T
|
||||
@@ -216,7 +216,7 @@ var r7 = c.foo4('', true); // string
|
||||
|
||||
var r8 = c.foo5(true, 1); // boolean
|
||||
>r8 : boolean
|
||||
>c.foo5(true, 1) : boolean
|
||||
>c.foo5(true, 1) : true
|
||||
>c.foo5 : <T, U>(t: T, u: U) => T
|
||||
>c : C<string, number>
|
||||
>foo5 : <T, U>(t: T, u: U) => T
|
||||
@@ -345,7 +345,7 @@ var r5 = i.foo2('', 1); // number
|
||||
|
||||
var r6 = i.foo3(true, 1); // boolean
|
||||
>r6 : boolean
|
||||
>i.foo3(true, 1) : boolean
|
||||
>i.foo3(true, 1) : true
|
||||
>i.foo3 : <T>(t: T, u: number) => T
|
||||
>i : I<string, number>
|
||||
>foo3 : <T>(t: T, u: number) => T
|
||||
@@ -363,7 +363,7 @@ var r7 = i.foo4('', true); // string
|
||||
|
||||
var r8 = i.foo5(true, 1); // boolean
|
||||
>r8 : boolean
|
||||
>i.foo5(true, 1) : boolean
|
||||
>i.foo5(true, 1) : true
|
||||
>i.foo5 : <T, U>(t: T, u: U) => T
|
||||
>i : I<string, number>
|
||||
>foo5 : <T, U>(t: T, u: U) => T
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(26,10): error TS2453: The type argument for type parameter 'U' 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'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,15): 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 'T'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,15): 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 'T'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,16): 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 'T'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,15): error TS2453: The type argument for type parameter 'U' 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'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts (5 errors) ====
|
||||
@@ -39,26 +39,26 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun
|
||||
var r8 = foo3(1, function (a) { return '' }, 1); // error
|
||||
~~~~
|
||||
!!! error TS2453: The type argument for type parameter 'U' 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'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
var r9 = foo3<number, string>(1, (a) => '', ''); // string
|
||||
|
||||
function other<T, U>(t: T, u: U) {
|
||||
var r10 = foo2(1, (x: T) => ''); // error
|
||||
~~~~
|
||||
!!! 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 'T'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
var r10 = foo2(1, (x) => ''); // string
|
||||
|
||||
var r11 = foo3(1, (x: T) => '', ''); // error
|
||||
~~~~
|
||||
!!! 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 'T'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
var r11b = foo3(1, (x: T) => '', 1); // error
|
||||
~~~~
|
||||
!!! 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 'T'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
var r12 = foo3(1, function (a) { return '' }, 1); // error
|
||||
~~~~
|
||||
!!! error TS2453: The type argument for type parameter 'U' 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'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(29,10): 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'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(40,10): 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'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts (2 errors) ====
|
||||
@@ -36,7 +36,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun
|
||||
var r4 = foo2(1, i2); // error
|
||||
~~~~
|
||||
!!! 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'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
var r4b = foo2(1, a); // any
|
||||
var r5 = foo2(1, i); // any
|
||||
var r6 = foo2<string, string>('', i2); // string
|
||||
@@ -50,5 +50,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun
|
||||
var r8 = foo3(1, i2, 1); // error
|
||||
~~~~
|
||||
!!! 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'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
var r9 = foo3<string, string>('', i2, ''); // string
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,19): 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 'T'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,19): 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 'T'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,20): 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 'T'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,19): error TS2453: The type argument for type parameter 'U' 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'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts (4 errors) ====
|
||||
@@ -68,20 +68,20 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu
|
||||
var r10 = c.foo2(1, (x: T) => ''); // error
|
||||
~~~~~~
|
||||
!!! 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 'T'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
var r10 = c.foo2(1, (x) => ''); // string
|
||||
|
||||
var r11 = c3.foo3(1, (x: T) => '', ''); // error
|
||||
~~~~~~~
|
||||
!!! 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 'T'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
var r11b = c3.foo3(1, (x: T) => '', 1); // error
|
||||
~~~~~~~
|
||||
!!! 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 'T'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'T'.
|
||||
var r12 = c3.foo3(1, function (a) { return '' }, 1); // error
|
||||
~~~~~~~
|
||||
!!! error TS2453: The type argument for type parameter 'U' 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'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ function foo<T > (x: T) { return x; }
|
||||
|
||||
var x = foo(5); // 'x' should be number
|
||||
>x : number
|
||||
>foo(5) : number
|
||||
>foo(5) : 5
|
||||
>foo : <T>(x: T) => T
|
||||
>5 : 5
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/genericRestArgs.ts(2,12): 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'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate '""'.
|
||||
tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/genericRestArgs.ts(10,12): 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'.
|
||||
Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate '""'.
|
||||
tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type '1' is not assignable to parameter of type 'any[]'.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type '
|
||||
var a1Ga = makeArrayG(1, ""); // no error
|
||||
~~~~~~~~~~
|
||||
!!! 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'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate '""'.
|
||||
var a1Gb = makeArrayG<any>(1, "");
|
||||
var a1Gc = makeArrayG<Object>(1, "");
|
||||
var a1Gd = makeArrayG<number>(1, ""); // error
|
||||
@@ -24,7 +24,7 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type '
|
||||
var a2Ga = makeArrayGOpt(1, "");
|
||||
~~~~~~~~~~~~~
|
||||
!!! 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'.
|
||||
!!! error TS2453: Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate '""'.
|
||||
var a2Gb = makeArrayG<any>(1, "");
|
||||
var a2Gc = makeArrayG<any[]>(1, ""); // error
|
||||
~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'Comparable<number>'.
|
||||
tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'Comparable<1 | 2>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/maxConstraints.ts (1 errors) ====
|
||||
@@ -11,4 +11,4 @@ tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type '1'
|
||||
var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y };
|
||||
var maxResult = max2(1, 2);
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'Comparable<number>'.
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'Comparable<1 | 2>'.
|
||||
@@ -14,8 +14,8 @@ async function test(isError: boolean = false) {
|
||||
}
|
||||
let x = await Promise.resolve("The test is passed without an error.");
|
||||
>x : string
|
||||
>await Promise.resolve("The test is passed without an error.") : "The test is passed without an error."
|
||||
>Promise.resolve("The test is passed without an error.") : Promise<"The test is passed without an error.">
|
||||
>await Promise.resolve("The test is passed without an error.") : string
|
||||
>Promise.resolve("The test is passed without an error.") : Promise<string>
|
||||
>Promise.resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
||||
|
||||
@@ -46,7 +46,7 @@ function fun<T>(...rest: any[]): T {
|
||||
|
||||
var a = fun(x => { x<number>(undefined); return x; }, 10);
|
||||
>a : number
|
||||
>fun(x => { x<number>(undefined); return x; }, 10) : number
|
||||
>fun(x => { x<number>(undefined); return x; }, 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
>x : <T>(p: T) => T
|
||||
@@ -58,7 +58,7 @@ var a = fun(x => { x<number>(undefined); return x; }, 10);
|
||||
|
||||
var b = fun((x => { x<number>(undefined); return x; }), 10);
|
||||
>b : number
|
||||
>fun((x => { x<number>(undefined); return x; }), 10) : number
|
||||
>fun((x => { x<number>(undefined); return x; }), 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
@@ -71,7 +71,7 @@ var b = fun((x => { x<number>(undefined); return x; }), 10);
|
||||
|
||||
var c = fun(((x => { x<number>(undefined); return x; })), 10);
|
||||
>c : number
|
||||
>fun(((x => { x<number>(undefined); return x; })), 10) : number
|
||||
>fun(((x => { x<number>(undefined); return x; })), 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
@@ -85,7 +85,7 @@ var c = fun(((x => { x<number>(undefined); return x; })), 10);
|
||||
|
||||
var d = fun((((x => { x<number>(undefined); return x; }))), 10);
|
||||
>d : number
|
||||
>fun((((x => { x<number>(undefined); return x; }))), 10) : number
|
||||
>fun((((x => { x<number>(undefined); return x; }))), 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>(((x => { x<number>(undefined); return x; }))) : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
@@ -100,7 +100,7 @@ var d = fun((((x => { x<number>(undefined); return x; }))), 10);
|
||||
|
||||
var e = fun(x => { x<number>(undefined); return x; }, x => { x<number>(undefined); return x; }, 10);
|
||||
>e : number
|
||||
>fun(x => { x<number>(undefined); return x; }, x => { x<number>(undefined); return x; }, 10) : number
|
||||
>fun(x => { x<number>(undefined); return x; }, x => { x<number>(undefined); return x; }, 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
>x : <T>(p: T) => T
|
||||
@@ -118,7 +118,7 @@ var e = fun(x => { x<number>(undefined); return x; }, x => { x<number>(undefined
|
||||
|
||||
var f = fun((x => { x<number>(undefined); return x; }),(x => { x<number>(undefined); return x; }), 10);
|
||||
>f : number
|
||||
>fun((x => { x<number>(undefined); return x; }),(x => { x<number>(undefined); return x; }), 10) : number
|
||||
>fun((x => { x<number>(undefined); return x; }),(x => { x<number>(undefined); return x; }), 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
@@ -138,7 +138,7 @@ var f = fun((x => { x<number>(undefined); return x; }),(x => { x<number>(undefin
|
||||
|
||||
var g = fun(((x => { x<number>(undefined); return x; })),((x => { x<number>(undefined); return x; })), 10);
|
||||
>g : number
|
||||
>fun(((x => { x<number>(undefined); return x; })),((x => { x<number>(undefined); return x; })), 10) : number
|
||||
>fun(((x => { x<number>(undefined); return x; })),((x => { x<number>(undefined); return x; })), 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
@@ -160,7 +160,7 @@ var g = fun(((x => { x<number>(undefined); return x; })),((x => { x<number>(unde
|
||||
|
||||
var h = fun((((x => { x<number>(undefined); return x; }))),((x => { x<number>(undefined); return x; })), 10);
|
||||
>h : number
|
||||
>fun((((x => { x<number>(undefined); return x; }))),((x => { x<number>(undefined); return x; })), 10) : number
|
||||
>fun((((x => { x<number>(undefined); return x; }))),((x => { x<number>(undefined); return x; })), 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>(((x => { x<number>(undefined); return x; }))) : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
@@ -184,7 +184,7 @@ var h = fun((((x => { x<number>(undefined); return x; }))),((x => { x<number>(un
|
||||
// Ternaries in parens
|
||||
var i = fun((Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x => undefined), 10);
|
||||
>i : number
|
||||
>fun((Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x => undefined), 10) : number
|
||||
>fun((Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x => undefined), 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>(Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x => undefined) : (x: <T>(p: T) => T) => any
|
||||
>Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x => undefined : (x: <T>(p: T) => T) => any
|
||||
@@ -207,7 +207,7 @@ var i = fun((Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x
|
||||
|
||||
var j = fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), 10);
|
||||
>j : number
|
||||
>fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), 10) : number
|
||||
>fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>(Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)) : (x: <T>(p: T) => T) => any
|
||||
>Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined) : (x: <T>(p: T) => T) => any
|
||||
@@ -232,7 +232,7 @@ var j = fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) :
|
||||
|
||||
var k = fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), x => { x<number>(undefined); return x; }, 10);
|
||||
>k : number
|
||||
>fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), x => { x<number>(undefined); return x; }, 10) : number
|
||||
>fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), x => { x<number>(undefined); return x; }, 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>(Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)) : (x: <T>(p: T) => T) => any
|
||||
>Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined) : (x: <T>(p: T) => T) => any
|
||||
@@ -263,7 +263,7 @@ var k = fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) :
|
||||
|
||||
var l = fun(((Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined)))),((x => { x<number>(undefined); return x; })), 10);
|
||||
>l : number
|
||||
>fun(((Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined)))),((x => { x<number>(undefined); return x; })), 10) : number
|
||||
>fun(((Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined)))),((x => { x<number>(undefined); return x; })), 10) : 10
|
||||
>fun : { <T>(f: FuncType, x: T): T; <T>(f: FuncType, g: FuncType, x: T): T; }
|
||||
>((Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined)))) : (x: <T>(p: T) => T) => any
|
||||
>(Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined))) : (x: <T>(p: T) => T) => any
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(16,15): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'boolean' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'false'.
|
||||
tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(25,1): error TS2304: Cannot find name 'runTestCase'.
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(25,1): error T
|
||||
var a = new Array(false,undefined,null,"0",obj,-1.3333333333333, "str",-0,true,+0, one, 1,0, false, _float, -(4/3));
|
||||
~~~~~
|
||||
!!! 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 'boolean' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
!!! error TS2453: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'false'.
|
||||
if (a.indexOf(-(4/3)) === 14 && // a[14]=_float===-(4/3)
|
||||
a.indexOf(0) === 7 && // a[7] = +0, 0===+0
|
||||
a.indexOf(-0) === 7 && // a[7] = +0, -0===+0
|
||||
|
||||
@@ -48,7 +48,7 @@ function tempTag1<T>(...rest: any[]): T {
|
||||
// and it is an error to invoke an any-typed value with type arguments,
|
||||
// so this test will error.
|
||||
tempTag1 `${ x => { x<number>(undefined); return x; } }${ 10 }`;
|
||||
>tempTag1 `${ x => { x<number>(undefined); return x; } }${ 10 }` : number
|
||||
>tempTag1 `${ x => { x<number>(undefined); return x; } }${ 10 }` : 10
|
||||
>tempTag1 : { <T>(templateStrs: TemplateStringsArray, f: FuncType, x: T): T; <T>(templateStrs: TemplateStringsArray, f: FuncType, h: FuncType, x: T): T; }
|
||||
>`${ x => { x<number>(undefined); return x; } }${ 10 }` : string
|
||||
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
@@ -60,7 +60,7 @@ tempTag1 `${ x => { x<number>(undefined); return x; } }${ 10 }
|
||||
>10 : 10
|
||||
|
||||
tempTag1 `${ x => { x<number>(undefined); return x; } }${ y => { y<number>(undefined); return y; } }${ 10 }`;
|
||||
>tempTag1 `${ x => { x<number>(undefined); return x; } }${ y => { y<number>(undefined); return y; } }${ 10 }` : number
|
||||
>tempTag1 `${ x => { x<number>(undefined); return x; } }${ y => { y<number>(undefined); return y; } }${ 10 }` : 10
|
||||
>tempTag1 : { <T>(templateStrs: TemplateStringsArray, f: FuncType, x: T): T; <T>(templateStrs: TemplateStringsArray, f: FuncType, h: FuncType, x: T): T; }
|
||||
>`${ x => { x<number>(undefined); return x; } }${ y => { y<number>(undefined); return y; } }${ 10 }` : string
|
||||
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,79): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
|
||||
Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: Date; }'.
|
||||
@@ -72,7 +72,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference
|
||||
var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`;
|
||||
~~~~~~~~~~~~~
|
||||
!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
!!! error TS2453: Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
var a9a: {};
|
||||
|
||||
// Generic tag with multiple parameters of generic type passed arguments with multiple best common types
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts(63,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts(76,79): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
|
||||
Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: Date; }'.
|
||||
@@ -71,7 +71,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference
|
||||
var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`;
|
||||
~~~~~~~~~~~~~
|
||||
!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
!!! error TS2453: Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
var a9a: {};
|
||||
|
||||
// Generic tag with multiple parameters of generic type passed arguments with multiple best common types
|
||||
|
||||
@@ -106,7 +106,7 @@ var c: C<boolean, Date>;
|
||||
|
||||
var r2 = c.foo(1, 2); // number
|
||||
>r2 : number
|
||||
>c.foo(1, 2) : number
|
||||
>c.foo(1, 2) : 1 | 2
|
||||
>c.foo : { (x: boolean, y: Date): string; (x: string, y: string): number; <W>(x: W, y: W): W; }
|
||||
>c : C<boolean, Date>
|
||||
>foo : { (x: boolean, y: Date): string; (x: string, y: string): number; <W>(x: W, y: W): W; }
|
||||
|
||||
@@ -94,7 +94,7 @@ module G {
|
||||
|
||||
var r4 = a(1, true);
|
||||
>r4 : number
|
||||
>a(1, true) : number
|
||||
>a(1, true) : 1
|
||||
>a : A<boolean>
|
||||
>1 : 1
|
||||
>true : true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/typeArgInference2WithError.ts(7,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
Type argument candidate '"abc"' is not a valid type argument because it is not a supertype of candidate '5'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/typeArgInference2WithError.ts (1 errors) ====
|
||||
@@ -12,4 +12,4 @@ tests/cases/compiler/typeArgInference2WithError.ts(7,10): error TS2453: The type
|
||||
var z7 = foo("abc", 5); // Error
|
||||
~~~
|
||||
!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
!!! error TS2453: Type argument candidate '"abc"' is not a valid type argument because it is not a supertype of candidate '5'.
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(68,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,69): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
|
||||
Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; z: Date; }'.
|
||||
@@ -78,7 +78,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(84,74
|
||||
var a9a = someGenerics9('', 0, []);
|
||||
~~~~~~~~~~~~~
|
||||
!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
!!! error TS2453: Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
var a9a: {};
|
||||
var a9b = someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null);
|
||||
var a9b: { a?: number; b?: string; };
|
||||
|
||||
@@ -10,7 +10,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct
|
||||
Types of parameters 'n' and 'b' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(106,15): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(118,9): error TS2304: Cannot find name 'Window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,51): error TS2304: Cannot find name 'window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,69): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
@@ -146,7 +146,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct
|
||||
var a9a = new someGenerics9('', 0, []);
|
||||
~~~~~~~~~~~~~
|
||||
!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
!!! error TS2453: Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
var a9a: {};
|
||||
var a9b = new someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null);
|
||||
var a9b: { a?: number; b?: string; };
|
||||
|
||||
@@ -15,7 +15,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(66,31): error TS2345: Argument of type '<A, B extends string, C>(a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) => void' is not assignable to parameter of type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(73,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(85,9): error TS2304: Cannot find name 'Window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,47): error TS2304: Cannot find name 'window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,65): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
@@ -128,7 +128,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
|
||||
var a9a = someGenerics9('', 0, []);
|
||||
~~~~~~~~~~~~~
|
||||
!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
!!! error TS2453: Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
var a9a: {};
|
||||
var a9b = someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null);
|
||||
var a9b: { a?: number; b?: string; };
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral.ts(30,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'E1' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral.ts(35,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'E1' is not a valid type argument because it is not a supertype of candidate 'E2'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral.ts (1 errors) ====
|
||||
==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral.ts (2 errors) ====
|
||||
interface Computed<T> {
|
||||
read(): T;
|
||||
write(value: T);
|
||||
@@ -33,6 +35,9 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithObjec
|
||||
var v1 = f1({ w: x => x, r: () => 0 }, 0);
|
||||
var v1 = f1({ w: x => x, r: () => 0 }, E1.X);
|
||||
var v1 = f1({ w: x => x, r: () => E1.X }, 0);
|
||||
~~
|
||||
!!! 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 'E1' is not a valid type argument because it is not a supertype of candidate '0'.
|
||||
|
||||
var v2: E1;
|
||||
var v2 = f1({ w: x => x, r: () => E1.X }, E1.X);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/typeInferenceConflictingCandidates.ts(3,1): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '3'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/typeInferenceConflictingCandidates.ts (1 errors) ====
|
||||
@@ -8,4 +8,4 @@ tests/cases/compiler/typeInferenceConflictingCandidates.ts(3,1): error TS2453: T
|
||||
g("", 3, a => a);
|
||||
~
|
||||
!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
!!! error TS2453: Type argument candidate '""' is not a valid type argument because it is not a supertype of candidate '3'.
|
||||
@@ -16,14 +16,14 @@ function foo<T, U extends T>(x: T, y: U): U { return y; }
|
||||
|
||||
var r = foo(1, 2);
|
||||
>r : number
|
||||
>foo(1, 2) : number
|
||||
>foo(1, 2) : 2
|
||||
>foo : <T, U extends T>(x: T, y: U) => U
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
var r = foo({}, 1);
|
||||
>r : number
|
||||
>foo({}, 1) : number
|
||||
>foo({}, 1) : 1
|
||||
>foo : <T, U extends T>(x: T, y: U) => U
|
||||
>{} : {}
|
||||
>1 : 1
|
||||
@@ -82,7 +82,7 @@ function foo2<T, U extends { length: T }>(x: T, y: U) { return y; }
|
||||
>y : U
|
||||
|
||||
foo2(1, '');
|
||||
>foo2(1, '') : string
|
||||
>foo2(1, '') : ""
|
||||
>foo2 : <T, U extends { length: T; }>(x: T, y: U) => U
|
||||
>1 : 1
|
||||
>'' : ""
|
||||
|
||||
@@ -45,7 +45,7 @@ function foo<T, U, V>(x: T, y: U, z: V): V { return z; }
|
||||
//function foo<T, U extends T, V extends U>(x: T, y: U, z: V): V { return z; }
|
||||
|
||||
foo(1, 2, 3);
|
||||
>foo(1, 2, 3) : number
|
||||
>foo(1, 2, 3) : 3
|
||||
>foo : <T, U, V>(x: T, y: U, z: V) => V
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
@@ -45,7 +45,7 @@ function foo<T, U, V>(x: T, y: U, z: V): V { return z; }
|
||||
//function foo<T, U extends T, V extends U>(x: T, y: U, z: V): V { return z; }
|
||||
|
||||
foo(1, 2, '');
|
||||
>foo(1, 2, '') : string
|
||||
>foo(1, 2, '') : ""
|
||||
>foo : <T, U, V>(x: T, y: U, z: V) => V
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
@@ -14,7 +14,7 @@ function f<T>(arr: T[], elemnt: T): T {
|
||||
|
||||
var a = f([], 3); // should be number
|
||||
>a : number
|
||||
>f([], 3) : number
|
||||
>f([], 3) : 3
|
||||
>f : <T>(arr: T[], elemnt: T) => T
|
||||
>[] : undefined[]
|
||||
>3 : 3
|
||||
|
||||
43
tests/baselines/reference/unionTypeInference.errors.txt
Normal file
43
tests/baselines/reference/unionTypeInference.errors.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts(9,15): error TS2345: Argument of type '2' is not assignable to parameter of type 'string | 1'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts(13,15): error TS2345: Argument of type 'number | "hello"' is not assignable to parameter of type 'string | 1'.
|
||||
Type 'number' is not assignable to type 'string | 1'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts (2 errors) ====
|
||||
// Verify that inferences made *to* a type parameter in a union type are secondary
|
||||
// to inferences made directly to that type parameter
|
||||
|
||||
function f<T>(x: T, y: string|T): T {
|
||||
return x;
|
||||
}
|
||||
|
||||
var a1: number;
|
||||
var a1 = f(1, 2);
|
||||
~
|
||||
!!! error TS2345: Argument of type '2' is not assignable to parameter of type 'string | 1'.
|
||||
var a2: number;
|
||||
var a2 = f(1, "hello");
|
||||
var a3: number;
|
||||
var a3 = f(1, a1 || "hello");
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'number | "hello"' is not assignable to parameter of type 'string | 1'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string | 1'.
|
||||
var a4: any;
|
||||
var a4 = f(undefined, "abc");
|
||||
|
||||
function g<T>(value: [string, T]): T {
|
||||
return value[1];
|
||||
}
|
||||
|
||||
var b1: boolean;
|
||||
var b1 = g(["string", true]);
|
||||
|
||||
function h<T>(x: string|boolean|T): T {
|
||||
return typeof x === "string" || typeof x === "boolean" ? undefined : x;
|
||||
}
|
||||
|
||||
var c1: number;
|
||||
var c1 = h(5);
|
||||
var c2: string;
|
||||
var c2 = h("abc");
|
||||
|
||||
@@ -56,7 +56,7 @@ var r = c.foo({ length: 3, charAt: (x: number) => { '' } });
|
||||
|
||||
var r2 = r('');
|
||||
>r2 : string
|
||||
>r('') : string
|
||||
>r('') : ""
|
||||
>r : <V extends { length: number; charAt: (x: number) => void; }>(x: V) => V
|
||||
>'' : ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user