mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
1 parent
1e48cbe2c9
commit
71c1da020f
274 files changed
+1691
-1374
No files matched your search
@@ -24886,7 +24886,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
|
||||
return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
|
||||
|
||||
function chooseOverload(candidates: Signature[], relation: Map<RelationComparisonResult>, signatureHelpTrailingComma = false) {
|
||||
candidatesForArgumentError = undefined;
|
||||
|
||||
@@ -122,7 +122,7 @@ baz(array); // Error
|
||||
baz(["string", 1, true, ...array]); // Error
|
||||
>baz(["string", 1, true, ...array]) : void
|
||||
>baz : (x: [string, number, boolean]) => void
|
||||
>["string", 1, true, ...array] : (string | number | boolean)[]
|
||||
>["string", 1, true, ...array] : [string, number, true, ...(string | number | boolean)[]]
|
||||
>"string" : "string"
|
||||
>1 : 1
|
||||
>true : true
|
||||
|
||||
@@ -17,8 +17,8 @@ class a {
|
||||
|
||||
|
||||
var xx = new a(null, 7, new B());
|
||||
>xx : any
|
||||
>new a(null, 7, new B()) : any
|
||||
>xx : a
|
||||
>new a(null, 7, new B()) : a
|
||||
>a : typeof a
|
||||
>null : null
|
||||
>7 : 7
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. Did you mean 'ELoc'?
|
||||
tests/cases/compiler/baseCheck.ts(17,53): error TS2554: Expected 2 arguments, but got 1.
|
||||
tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
tests/cases/compiler/baseCheck.ts(18,62): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/baseCheck.ts(19,68): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
tests/cases/compiler/baseCheck.ts(22,9): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/baseCheck.ts(23,7): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/baseCheck.ts (9 errors) ====
|
||||
==== tests/cases/compiler/baseCheck.ts (7 errors) ====
|
||||
class C { constructor(x: number, y: number) { } }
|
||||
class ELoc extends C {
|
||||
constructor(x: number) {
|
||||
@@ -33,16 +31,12 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 tests/cases/compiler/baseCheck.ts:1:34: An argument for 'y' was not provided.
|
||||
~~~~
|
||||
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
class E extends C { constructor(public z: number) { super(0, this.z) } }
|
||||
~~~~
|
||||
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
class F extends C { constructor(public z: number) { super("hello", this.z) } } // first param type
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
~~~~
|
||||
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
|
||||
function f() {
|
||||
if (x<10) {
|
||||
|
||||
@@ -94,9 +94,9 @@ bigIntArray = new BigInt64Array([1n, 2n, 3n]);
|
||||
>3n : 3n
|
||||
|
||||
bigIntArray = new BigInt64Array([1, 2, 3]); // should error
|
||||
>bigIntArray = new BigInt64Array([1, 2, 3]) : any
|
||||
>bigIntArray = new BigInt64Array([1, 2, 3]) : BigInt64Array
|
||||
>bigIntArray : BigInt64Array
|
||||
>new BigInt64Array([1, 2, 3]) : any
|
||||
>new BigInt64Array([1, 2, 3]) : BigInt64Array
|
||||
>BigInt64Array : BigInt64ArrayConstructor
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : 1
|
||||
@@ -174,9 +174,9 @@ bigUintArray = new BigUint64Array([1n, 2n, 3n]);
|
||||
>3n : 3n
|
||||
|
||||
bigUintArray = new BigUint64Array([1, 2, 3]); // should error
|
||||
>bigUintArray = new BigUint64Array([1, 2, 3]) : any
|
||||
>bigUintArray = new BigUint64Array([1, 2, 3]) : BigUint64Array
|
||||
>bigUintArray : BigUint64Array
|
||||
>new BigUint64Array([1, 2, 3]) : any
|
||||
>new BigUint64Array([1, 2, 3]) : BigUint64Array
|
||||
>BigUint64Array : BigUint64ArrayConstructor
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : 1
|
||||
|
||||
@@ -56,7 +56,7 @@ let stringVal: string = bigintVal.toString(); // should not error - bigintVal in
|
||||
>toString : () => string
|
||||
|
||||
stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {}
|
||||
>stringVal = bigintVal.toString(2) : any
|
||||
>stringVal = bigintVal.toString(2) : string
|
||||
>stringVal : string
|
||||
>bigintVal.toString(2) : string
|
||||
>bigintVal.toString : () => string
|
||||
|
||||
@@ -16,7 +16,7 @@ function foo(a: number) {
|
||||
>foo : { (): void; (): void; }
|
||||
|
||||
foo(10); // not ok
|
||||
>foo(10) : any
|
||||
>foo(10) : void
|
||||
>foo : { (): void; (): void; }
|
||||
>10 : 10
|
||||
}
|
||||
@@ -29,12 +29,12 @@ function foo(a: number) {
|
||||
>foo : { (): void; (): void; }
|
||||
|
||||
foo(10); // not ok
|
||||
>foo(10) : any
|
||||
>foo(10) : void
|
||||
>foo : { (): void; (): void; }
|
||||
>10 : 10
|
||||
}
|
||||
foo(10); // not ok
|
||||
>foo(10) : any
|
||||
>foo(10) : void
|
||||
>foo : { (): void; (): void; }
|
||||
>10 : 10
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function foo(a: number) {
|
||||
>foo : { (): void; (): void; }
|
||||
|
||||
foo(10); // not ok
|
||||
>foo(10) : any
|
||||
>foo(10) : void
|
||||
>foo : { (): void; (): void; }
|
||||
>10 : 10
|
||||
}
|
||||
@@ -29,12 +29,12 @@ function foo(a: number) {
|
||||
>foo : { (): void; (): void; }
|
||||
|
||||
foo(10);// not ok
|
||||
>foo(10) : any
|
||||
>foo(10) : void
|
||||
>foo : { (): void; (): void; }
|
||||
>10 : 10
|
||||
}
|
||||
foo(10); // not ok
|
||||
>foo(10) : any
|
||||
>foo(10) : void
|
||||
>foo : { (): void; (): void; }
|
||||
>10 : 10
|
||||
|
||||
|
||||
+20
-20
@@ -9,15 +9,15 @@ function f<T, U>(x: T, y: U): T { return null; }
|
||||
>null : null
|
||||
|
||||
var r1 = f<number>(1, '');
|
||||
>r1 : any
|
||||
>f<number>(1, '') : any
|
||||
>r1 : number
|
||||
>f<number>(1, '') : number
|
||||
>f : <T, U>(x: T, y: U) => T
|
||||
>1 : 1
|
||||
>'' : ""
|
||||
|
||||
var r1b = f<number, string, number>(1, '');
|
||||
>r1b : any
|
||||
>f<number, string, number>(1, '') : any
|
||||
>r1b : number
|
||||
>f<number, string, number>(1, '') : number
|
||||
>f : <T, U>(x: T, y: U) => T
|
||||
>1 : 1
|
||||
>'' : ""
|
||||
@@ -30,15 +30,15 @@ var f2 = <T, U>(x: T, y: U): T => { return null; }
|
||||
>null : null
|
||||
|
||||
var r2 = f2<number>(1, '');
|
||||
>r2 : any
|
||||
>f2<number>(1, '') : any
|
||||
>r2 : number
|
||||
>f2<number>(1, '') : number
|
||||
>f2 : <T, U>(x: T, y: U) => T
|
||||
>1 : 1
|
||||
>'' : ""
|
||||
|
||||
var r2b = f2<number, string, number>(1, '');
|
||||
>r2b : any
|
||||
>f2<number, string, number>(1, '') : any
|
||||
>r2b : number
|
||||
>f2<number, string, number>(1, '') : number
|
||||
>f2 : <T, U>(x: T, y: U) => T
|
||||
>1 : 1
|
||||
>'' : ""
|
||||
@@ -49,15 +49,15 @@ var f3: { <T, U>(x: T, y: U): T; }
|
||||
>y : U
|
||||
|
||||
var r3 = f3<number>(1, '');
|
||||
>r3 : any
|
||||
>f3<number>(1, '') : any
|
||||
>r3 : number
|
||||
>f3<number>(1, '') : number
|
||||
>f3 : <T, U>(x: T, y: U) => T
|
||||
>1 : 1
|
||||
>'' : ""
|
||||
|
||||
var r3b = f3<number, string, number>(1, '');
|
||||
>r3b : any
|
||||
>f3<number, string, number>(1, '') : any
|
||||
>r3b : number
|
||||
>f3<number, string, number>(1, '') : number
|
||||
>f3 : <T, U>(x: T, y: U) => T
|
||||
>1 : 1
|
||||
>'' : ""
|
||||
@@ -75,8 +75,8 @@ class C {
|
||||
}
|
||||
}
|
||||
var r4 = (new C()).f<number>(1, '');
|
||||
>r4 : any
|
||||
>(new C()).f<number>(1, '') : any
|
||||
>r4 : number
|
||||
>(new C()).f<number>(1, '') : number
|
||||
>(new C()).f : <T, U>(x: T, y: U) => T
|
||||
>(new C()) : C
|
||||
>new C() : C
|
||||
@@ -86,8 +86,8 @@ var r4 = (new C()).f<number>(1, '');
|
||||
>'' : ""
|
||||
|
||||
var r4b = (new C()).f<number, string, number>(1, '');
|
||||
>r4b : any
|
||||
>(new C()).f<number, string, number>(1, '') : any
|
||||
>r4b : number
|
||||
>(new C()).f<number, string, number>(1, '') : number
|
||||
>(new C()).f : <T, U>(x: T, y: U) => T
|
||||
>(new C()) : C
|
||||
>new C() : C
|
||||
@@ -106,8 +106,8 @@ var i: I;
|
||||
>i : I
|
||||
|
||||
var r5 = i.f<number>(1, '');
|
||||
>r5 : any
|
||||
>i.f<number>(1, '') : any
|
||||
>r5 : number
|
||||
>i.f<number>(1, '') : number
|
||||
>i.f : <T, U>(x: T, y: U) => T
|
||||
>i : I
|
||||
>f : <T, U>(x: T, y: U) => T
|
||||
@@ -115,8 +115,8 @@ var r5 = i.f<number>(1, '');
|
||||
>'' : ""
|
||||
|
||||
var r5b = i.f<number, string, number>(1, '');
|
||||
>r5b : any
|
||||
>i.f<number, string, number>(1, '') : any
|
||||
>r5b : number
|
||||
>i.f<number, string, number>(1, '') : number
|
||||
>i.f : <T, U>(x: T, y: U) => T
|
||||
>i : I
|
||||
>f : <T, U>(x: T, y: U) => T
|
||||
|
||||
@@ -19,7 +19,7 @@ function foo() {
|
||||
>"expects boolean instead of string" : "expects boolean instead of string"
|
||||
|
||||
test(true); // should error - string expected
|
||||
>test(true) : any
|
||||
>test(true) : void
|
||||
>test : I1<string>
|
||||
>true : true
|
||||
}
|
||||
@@ -99,7 +99,7 @@ new MyPromise<void | number>(resolve => resolve()); // no error
|
||||
new MyPromise<any>(resolve => resolve()); // error, `any` arguments cannot be omitted
|
||||
>new MyPromise<any>(resolve => resolve()) : MyPromise<any>
|
||||
>MyPromise : typeof MyPromise
|
||||
>resolve => resolve() : (resolve: (value: any) => void) => any
|
||||
>resolve => resolve() : (resolve: (value: any) => void) => void
|
||||
>resolve : (value: any) => void
|
||||
>resolve() : void
|
||||
>resolve : (value: any) => void
|
||||
@@ -107,7 +107,7 @@ new MyPromise<any>(resolve => resolve()); // error, `any` arguments cannot be om
|
||||
new MyPromise<unknown>(resolve => resolve()); // error, `unknown` arguments cannot be omitted
|
||||
>new MyPromise<unknown>(resolve => resolve()) : MyPromise<unknown>
|
||||
>MyPromise : typeof MyPromise
|
||||
>resolve => resolve() : (resolve: (value: unknown) => void) => any
|
||||
>resolve => resolve() : (resolve: (value: unknown) => void) => void
|
||||
>resolve : (value: unknown) => void
|
||||
>resolve() : void
|
||||
>resolve : (value: unknown) => void
|
||||
@@ -115,7 +115,7 @@ new MyPromise<unknown>(resolve => resolve()); // error, `unknown` arguments cann
|
||||
new MyPromise<never>(resolve => resolve()); // error, `never` arguments cannot be omitted
|
||||
>new MyPromise<never>(resolve => resolve()) : MyPromise<never>
|
||||
>MyPromise : typeof MyPromise
|
||||
>resolve => resolve() : (resolve: (value: never) => void) => any
|
||||
>resolve => resolve() : (resolve: (value: never) => void) => void
|
||||
>resolve : (value: never) => void
|
||||
>resolve() : void
|
||||
>resolve : (value: never) => void
|
||||
@@ -234,7 +234,7 @@ declare function call<TS extends unknown[]>(
|
||||
>args : TS
|
||||
|
||||
call((x: number, y: number) => x + y) // error
|
||||
>call((x: number, y: number) => x + y) : any
|
||||
>call((x: number, y: number) => x + y) : void
|
||||
>call : <TS extends unknown[]>(handler: (...args: TS) => unknown, ...args: TS) => void
|
||||
>(x: number, y: number) => x + y : (x: number, y: number) => number
|
||||
>x : number
|
||||
|
||||
@@ -3,7 +3,7 @@ function f<T, U>() { }
|
||||
>f : <T, U>() => void
|
||||
|
||||
f<number>();
|
||||
>f<number>() : any
|
||||
>f<number>() : void
|
||||
>f : <T, U>() => void
|
||||
|
||||
f<number, string>();
|
||||
@@ -11,6 +11,6 @@ f<number, string>();
|
||||
>f : <T, U>() => void
|
||||
|
||||
f<number, string, number>();
|
||||
>f<number, string, number>() : any
|
||||
>f<number, string, number>() : void
|
||||
>f : <T, U>() => void
|
||||
|
||||
+5
-1
@@ -1,7 +1,8 @@
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,64): error TS2741: Property 'z' is missing in type 'B' but required in type 'C'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,81): error TS2739: Type 'A' is missing the following properties from type 'C': z, y
|
||||
|
||||
|
||||
==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (1 errors) ====
|
||||
==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (2 errors) ====
|
||||
class Chain<T extends A> {
|
||||
constructor(public value: T) { }
|
||||
then<S extends T>(cb: (x: T) => S): Chain<S> {
|
||||
@@ -24,4 +25,7 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete
|
||||
~~~~~
|
||||
!!! error TS2741: Property 'z' is missing in type 'B' but required in type 'C'.
|
||||
!!! related TS2728 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:15:5: 'z' is declared here.
|
||||
!!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature.
|
||||
~~~~~
|
||||
!!! error TS2739: Type 'A' is missing the following properties from type 'C': z, y
|
||||
!!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature.
|
||||
+2
@@ -46,6 +46,7 @@ class C extends B {
|
||||
|
||||
// Ok to go down the chain, but error to try to climb back up
|
||||
(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A);
|
||||
>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
|
||||
>(new Chain(new A)).then(a => new B).then(b => new C).then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
|
||||
>(new Chain(new A)).then(a => new B).then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
|
||||
>(new Chain(new A)).then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
|
||||
@@ -60,6 +61,7 @@ class C extends B {
|
||||
>then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
|
||||
>c : Symbol(c, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 18, 58))
|
||||
>B : Symbol(B, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 9, 1))
|
||||
>then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
|
||||
>b : Symbol(b, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 18, 75))
|
||||
>A : Symbol(A, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 5, 1))
|
||||
|
||||
+6
-6
@@ -38,9 +38,9 @@ class C extends B {
|
||||
|
||||
// Ok to go down the chain, but error to try to climb back up
|
||||
(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A);
|
||||
>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A) : any
|
||||
>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then : any
|
||||
>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B) : any
|
||||
>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A) : Chain<C>
|
||||
>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then : <S extends C>(cb: (x: C) => S) => Chain<S>
|
||||
>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B) : Chain<C>
|
||||
>(new Chain(new A)).then(a => new B).then(b => new C).then : <S extends C>(cb: (x: C) => S) => Chain<S>
|
||||
>(new Chain(new A)).then(a => new B).then(b => new C) : Chain<C>
|
||||
>(new Chain(new A)).then(a => new B).then : <S extends B>(cb: (x: B) => S) => Chain<S>
|
||||
@@ -66,9 +66,9 @@ class C extends B {
|
||||
>c : C
|
||||
>new B : B
|
||||
>B : typeof B
|
||||
>then : any
|
||||
>b => new A : (b: any) => A
|
||||
>b : any
|
||||
>then : <S extends C>(cb: (x: C) => S) => Chain<S>
|
||||
>b => new A : (b: C) => A
|
||||
>b : C
|
||||
>new A : A
|
||||
>A : typeof A
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ class Chain<T> {
|
||||
|
||||
// Ok to go down the chain, but error to climb up the chain
|
||||
(new Chain(t)).then(tt => s).then(ss => t);
|
||||
>(new Chain(t)).then(tt => s).then(ss => t) : any
|
||||
>(new Chain(t)).then(tt => s).then(ss => t) : Chain<S>
|
||||
>(new Chain(t)).then(tt => s).then : <S extends S>(cb: (x: S) => S) => Chain<S>
|
||||
>(new Chain(t)).then(tt => s) : Chain<S>
|
||||
>(new Chain(t)).then : <S extends T>(cb: (x: T) => S) => Chain<S>
|
||||
@@ -37,7 +37,7 @@ class Chain<T> {
|
||||
|
||||
// But error to try to climb up the chain
|
||||
(new Chain(s)).then(ss => t);
|
||||
>(new Chain(s)).then(ss => t) : any
|
||||
>(new Chain(s)).then(ss => t) : Chain<S>
|
||||
>(new Chain(s)).then : <S extends S>(cb: (x: S) => S) => Chain<S>
|
||||
>(new Chain(s)) : Chain<S>
|
||||
>new Chain(s) : Chain<S>
|
||||
|
||||
@@ -4,10 +4,11 @@ tests/cases/conformance/jsdoc/0.js(11,20): error TS2322: Type '"lol"' is not ass
|
||||
tests/cases/conformance/jsdoc/0.js(13,15): error TS2322: Type '"0"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(15,3): error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/0.js(19,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/0.js(22,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"' is not assignable to parameter of type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsdoc/0.js (7 errors) ====
|
||||
==== tests/cases/conformance/jsdoc/0.js (8 errors) ====
|
||||
// @ts-check
|
||||
var lol;
|
||||
const obj = {
|
||||
@@ -42,5 +43,7 @@ tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"'
|
||||
|
||||
/** @type {string} */
|
||||
var s1 = obj.method2("0");
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '"0"' is not assignable to parameter of type 'number'.
|
||||
@@ -284,13 +284,13 @@ chowder.flavour.claim
|
||||
>claim : "ignorant" | "malicious"
|
||||
|
||||
var errorNoArgs = new Chowder();
|
||||
>errorNoArgs : any
|
||||
>new Chowder() : any
|
||||
>errorNoArgs : Chowder
|
||||
>new Chowder() : Chowder
|
||||
>Chowder : typeof Chowder
|
||||
|
||||
var errorArgType = new Chowder(0);
|
||||
>errorArgType : any
|
||||
>new Chowder(0) : any
|
||||
>errorArgType : Chowder
|
||||
>new Chowder(0) : Chowder
|
||||
>Chowder : typeof Chowder
|
||||
>0 : 0
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ var r = C;
|
||||
>C : typeof C
|
||||
|
||||
var c = new C(); // error
|
||||
>c : any
|
||||
>new C() : any
|
||||
>c : C
|
||||
>new C() : C
|
||||
>C : typeof C
|
||||
|
||||
var c2 = new C(1); // ok
|
||||
@@ -49,8 +49,8 @@ var r2 = D;
|
||||
>D : typeof D
|
||||
|
||||
var d = new D(); // error
|
||||
>d : any
|
||||
>new D() : any
|
||||
>d : D<unknown, unknown>
|
||||
>new D() : D<unknown, unknown>
|
||||
>D : typeof D
|
||||
|
||||
var d2 = new D(1); // ok
|
||||
@@ -73,8 +73,8 @@ var r3 = D2;
|
||||
>D2 : typeof D2
|
||||
|
||||
var d3 = new D(); // error
|
||||
>d3 : any
|
||||
>new D() : any
|
||||
>d3 : D<unknown, unknown>
|
||||
>new D() : D<unknown, unknown>
|
||||
>D : typeof D
|
||||
|
||||
var d4 = new D(1); // ok
|
||||
@@ -96,8 +96,8 @@ var r4 = D3;
|
||||
>D3 : typeof D3
|
||||
|
||||
var d5 = new D(); // error
|
||||
>d5 : any
|
||||
>new D() : any
|
||||
>d5 : D<unknown, unknown>
|
||||
>new D() : D<unknown, unknown>
|
||||
>D : typeof D
|
||||
|
||||
var d6 = new D(1); // ok
|
||||
|
||||
@@ -10,8 +10,8 @@ module NonGeneric {
|
||||
}
|
||||
|
||||
var c = new C(); // error
|
||||
>c : any
|
||||
>new C() : any
|
||||
>c : C
|
||||
>new C() : C
|
||||
>C : typeof C
|
||||
|
||||
var c2 = new C(''); // ok
|
||||
@@ -34,8 +34,8 @@ module NonGeneric {
|
||||
}
|
||||
|
||||
var c3 = new C2(); // error
|
||||
>c3 : any
|
||||
>new C2() : any
|
||||
>c3 : C2
|
||||
>new C2() : C2
|
||||
>C2 : typeof C2
|
||||
|
||||
var c4 = new C2(''); // ok
|
||||
@@ -55,8 +55,8 @@ module NonGeneric {
|
||||
>C2 : C2
|
||||
|
||||
var d = new D(); // error
|
||||
>d : any
|
||||
>new D() : any
|
||||
>d : D
|
||||
>new D() : D
|
||||
>D : typeof D
|
||||
|
||||
var d2 = new D(1); // ok
|
||||
@@ -83,8 +83,8 @@ module Generics {
|
||||
}
|
||||
|
||||
var c = new C(); // error
|
||||
>c : any
|
||||
>new C() : any
|
||||
>c : C<unknown>
|
||||
>new C() : C<unknown>
|
||||
>C : typeof C
|
||||
|
||||
var c2 = new C(''); // ok
|
||||
@@ -108,8 +108,8 @@ module Generics {
|
||||
}
|
||||
|
||||
var c3 = new C2(); // error
|
||||
>c3 : any
|
||||
>new C2() : any
|
||||
>c3 : C2<unknown, unknown>
|
||||
>new C2() : C2<unknown, unknown>
|
||||
>C2 : typeof C2
|
||||
|
||||
var c4 = new C2(''); // ok
|
||||
@@ -130,8 +130,8 @@ module Generics {
|
||||
>C2 : C2<T, U>
|
||||
|
||||
var d = new D(); // error
|
||||
>d : any
|
||||
>new D() : any
|
||||
>d : D<unknown, unknown>
|
||||
>new D() : D<unknown, unknown>
|
||||
>D : typeof D
|
||||
|
||||
var d2 = new D(1); // ok
|
||||
|
||||
@@ -17,8 +17,8 @@ var c = new C();
|
||||
>C : typeof C
|
||||
|
||||
var c2 = new C(null); // error
|
||||
>c2 : any
|
||||
>new C(null) : any
|
||||
>c2 : C
|
||||
>new C(null) : C
|
||||
>C : typeof C
|
||||
>null : null
|
||||
|
||||
@@ -40,8 +40,8 @@ var d = new D();
|
||||
>D : typeof D
|
||||
|
||||
var d2 = new D(null); // error
|
||||
>d2 : any
|
||||
>new D(null) : any
|
||||
>d2 : D<Date>
|
||||
>new D(null) : D<Date>
|
||||
>D : typeof D
|
||||
>null : null
|
||||
|
||||
@@ -14,8 +14,8 @@ module T1 {
|
||||
>bar : () => any
|
||||
|
||||
var r = new m3d(); // error
|
||||
>r : any
|
||||
>new m3d() : any
|
||||
>r : m3d
|
||||
>new m3d() : m3d
|
||||
>m3d : typeof m3d
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ module T2 {
|
||||
>2 : 2
|
||||
|
||||
var r = new m3d(); // error
|
||||
>r : any
|
||||
>new m3d() : any
|
||||
>r : m3d
|
||||
>new m3d() : m3d
|
||||
>m3d : typeof m3d
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ declare class m3d { constructor(foo); foo(): void; static bar(); }
|
||||
>bar : () => any
|
||||
|
||||
var r = new m3d(); // error
|
||||
>r : any
|
||||
>new m3d() : any
|
||||
>r : m3d
|
||||
>new m3d() : m3d
|
||||
>m3d : typeof m3d
|
||||
|
||||
declare class m4d extends m3d { }
|
||||
@@ -132,7 +132,7 @@ declare class m4d extends m3d { }
|
||||
>m3d : m3d
|
||||
|
||||
var r2 = new m4d(); // error
|
||||
>r2 : any
|
||||
>new m4d() : any
|
||||
>r2 : m4d
|
||||
>new m4d() : m4d
|
||||
>m4d : typeof m4d
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(1,7): error TS2506: 'S18' is referenced directly or indirectly in its own base expression.
|
||||
tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(4,10): error TS2554: Expected 0 arguments, but got 1.
|
||||
tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(4,16): error TS2339: Property 'S18' does not exist on type 'S18<unknown, unknown, unknown>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts (2 errors) ====
|
||||
==== tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts (3 errors) ====
|
||||
class S18<B, A, C> extends S18<A[], { S19: A; (): A }[], C[]>
|
||||
~~~
|
||||
!!! error TS2506: 'S18' is referenced directly or indirectly in its own base expression.
|
||||
@@ -11,4 +12,6 @@ tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(4,10): err
|
||||
(new S18(123)).S18 = 0;
|
||||
~~~
|
||||
!!! error TS2554: Expected 0 arguments, but got 1.
|
||||
~~~
|
||||
!!! error TS2339: Property 'S18' does not exist on type 'S18<unknown, unknown, unknown>'.
|
||||
|
||||
@@ -8,8 +8,8 @@ class S18<B, A, C> extends S18<A[], { S19: A; (): A }[], C[]>
|
||||
(new S18(123)).S18 = 0;
|
||||
>(new S18(123)).S18 = 0 : 0
|
||||
>(new S18(123)).S18 : any
|
||||
>(new S18(123)) : any
|
||||
>new S18(123) : any
|
||||
>(new S18(123)) : S18<unknown, unknown, unknown>
|
||||
>new S18(123) : S18<unknown, unknown, unknown>
|
||||
>S18 : typeof S18
|
||||
>123 : 123
|
||||
>S18 : any
|
||||
|
||||
@@ -178,7 +178,7 @@ function C7(num) {}
|
||||
>num : number
|
||||
|
||||
var c7_v1 = new C7();
|
||||
>c7_v1 : any
|
||||
>new C7() : any
|
||||
>c7_v1 : C7
|
||||
>new C7() : C7
|
||||
>C7 : typeof C7
|
||||
|
||||
@@ -11,7 +11,7 @@ class D<T, U> {
|
||||
}
|
||||
|
||||
var d = new D<number>();
|
||||
>d : any
|
||||
>new D<number>() : any
|
||||
>d : D<number, unknown>
|
||||
>new D<number>() : D<number, unknown>
|
||||
>D : typeof D
|
||||
|
||||
@@ -9,9 +9,9 @@ tests/cases/compiler/constructorOverloads1.ts(16,18): error TS2769: No overload
|
||||
Argument of type 'Foo' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2769: No overload matches this call.
|
||||
Overload 1 of 2, '(s: string): Foo', gave the following error.
|
||||
Argument of type 'any[]' is not assignable to parameter of type 'string'.
|
||||
Argument of type 'Foo[]' is not assignable to parameter of type 'string'.
|
||||
Overload 2 of 2, '(n: number): Foo', gave the following error.
|
||||
Argument of type 'any[]' is not assignable to parameter of type 'number'.
|
||||
Argument of type 'Foo[]' is not assignable to parameter of type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constructorOverloads1.ts (6 errors) ====
|
||||
@@ -53,9 +53,9 @@ tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2769: No overload
|
||||
~~~~~~~~~~
|
||||
!!! error TS2769: No overload matches this call.
|
||||
!!! error TS2769: Overload 1 of 2, '(s: string): Foo', gave the following error.
|
||||
!!! error TS2769: Argument of type 'any[]' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2769: Argument of type 'Foo[]' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2769: Overload 2 of 2, '(n: number): Foo', gave the following error.
|
||||
!!! error TS2769: Argument of type 'any[]' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2769: Argument of type 'Foo[]' is not assignable to parameter of type 'number'.
|
||||
|
||||
f1.bar1();
|
||||
f1.bar2();
|
||||
|
||||
@@ -36,19 +36,19 @@ var f2 = new Foo(0);
|
||||
>0 : 0
|
||||
|
||||
var f3 = new Foo(f1);
|
||||
>f3 : any
|
||||
>new Foo(f1) : any
|
||||
>f3 : Foo
|
||||
>new Foo(f1) : Foo
|
||||
>Foo : typeof Foo
|
||||
>f1 : Foo
|
||||
|
||||
var f4 = new Foo([f1,f2,f3]);
|
||||
>f4 : any
|
||||
>new Foo([f1,f2,f3]) : any
|
||||
>f4 : Foo
|
||||
>new Foo([f1,f2,f3]) : Foo
|
||||
>Foo : typeof Foo
|
||||
>[f1,f2,f3] : any[]
|
||||
>[f1,f2,f3] : Foo[]
|
||||
>f1 : Foo
|
||||
>f2 : Foo
|
||||
>f3 : any
|
||||
>f3 : Foo
|
||||
|
||||
f1.bar1();
|
||||
>f1.bar1() : void
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(19,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(19,13): error TS2345: Argument of type '<T>(x: T, y: T) => T' is not assignable to parameter of type '(x: number, y: string) => number'.
|
||||
Types of parameters 'y' and 'y' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(20,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(20,23): error TS2345: Argument of type '<T>(x: T, y: T) => T' is not assignable to parameter of type '(x: number, y: string) => number'.
|
||||
Types of parameters 'y' and 'y' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(21,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(21,23): error TS2345: Argument of type '<T>(x: T, y: T) => T' is not assignable to parameter of type '(x: string, y: number) => string'.
|
||||
Types of parameters 'y' and 'y' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts (3 errors) ====
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts (6 errors) ====
|
||||
// TypeScript Spec, section 4.12.2:
|
||||
// If e is an expression of a function type that contains exactly one generic call signature and no other members,
|
||||
// and T is a function type with exactly one non - generic call signature and no other members, then any inferences
|
||||
@@ -29,16 +32,25 @@ tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatur
|
||||
|
||||
var b: number | string;
|
||||
var b = foo(g); // Error, number and string are disjoint types
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
|
||||
!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts:18:5: 'b' was also declared here.
|
||||
~
|
||||
!!! error TS2345: Argument of type '<T>(x: T, y: T) => T' is not assignable to parameter of type '(x: number, y: string) => number'.
|
||||
!!! error TS2345: Types of parameters 'y' and 'y' are incompatible.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
||||
var b = bar(1, "one", g); // Error, number and string are disjoint types
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
|
||||
!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts:18:5: 'b' was also declared here.
|
||||
~
|
||||
!!! error TS2345: Argument of type '<T>(x: T, y: T) => T' is not assignable to parameter of type '(x: number, y: string) => number'.
|
||||
!!! error TS2345: Types of parameters 'y' and 'y' are incompatible.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
||||
var b = bar("one", 1, g); // Error, number and string are disjoint types
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
|
||||
!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts:18:5: 'b' was also declared here.
|
||||
~
|
||||
!!! error TS2345: Argument of type '<T>(x: T, y: T) => T' is not assignable to parameter of type '(x: string, y: number) => string'.
|
||||
!!! error TS2345: Types of parameters 'y' and 'y' are incompatible.
|
||||
|
||||
@@ -61,13 +61,13 @@ var b: number | string;
|
||||
|
||||
var b = foo(g); // Error, number and string are disjoint types
|
||||
>b : string | number
|
||||
>foo(g) : any
|
||||
>foo(g) : unknown
|
||||
>foo : <T>(cb: (x: number, y: string) => T) => T
|
||||
>g : <T>(x: T, y: T) => T
|
||||
|
||||
var b = bar(1, "one", g); // Error, number and string are disjoint types
|
||||
>b : string | number
|
||||
>bar(1, "one", g) : any
|
||||
>bar(1, "one", g) : unknown
|
||||
>bar : <T, U, V>(x: T, y: U, cb: (x: T, y: U) => V) => V
|
||||
>1 : 1
|
||||
>"one" : "one"
|
||||
@@ -75,7 +75,7 @@ var b = bar(1, "one", g); // Error, number and string are disjoint types
|
||||
|
||||
var b = bar("one", 1, g); // Error, number and string are disjoint types
|
||||
>b : string | number
|
||||
>bar("one", 1, g) : any
|
||||
>bar("one", 1, g) : unknown
|
||||
>bar : <T, U, V>(x: T, y: U, cb: (x: T, y: U) => V) => V
|
||||
>"one" : "one"
|
||||
>1 : 1
|
||||
|
||||
@@ -37,8 +37,8 @@ var f = (x: number) => { return x.toFixed() };
|
||||
>toFixed : (fractionDigits?: number) => string
|
||||
|
||||
var r5 = _.forEach<number>(c2, f);
|
||||
>r5 : any
|
||||
>_.forEach<number>(c2, f) : any
|
||||
>r5 : void
|
||||
>_.forEach<number>(c2, f) : void
|
||||
>_.forEach : <T>(c: Collection<T>, f: (x: T) => Date) => void
|
||||
>_ : Combinators
|
||||
>forEach : <T>(c: Collection<T>, f: (x: T) => Date) => void
|
||||
@@ -46,8 +46,8 @@ var r5 = _.forEach<number>(c2, f);
|
||||
>f : (x: number) => string
|
||||
|
||||
var r6 = _.forEach<number>(c2, (x) => { return x.toFixed() });
|
||||
>r6 : any
|
||||
>_.forEach<number>(c2, (x) => { return x.toFixed() }) : any
|
||||
>r6 : void
|
||||
>_.forEach<number>(c2, (x) => { return x.toFixed() }) : void
|
||||
>_.forEach : <T>(c: Collection<T>, f: (x: T) => Date) => void
|
||||
>_ : Combinators
|
||||
>forEach : <T>(c: Collection<T>, f: (x: T) => Date) => void
|
||||
|
||||
@@ -19,8 +19,8 @@ f10('', () => a => a.foo, ''); // a is ""
|
||||
>'' : ""
|
||||
|
||||
var r9 = f10('', () => (a => a.foo), 1); // error
|
||||
>r9 : any
|
||||
>f10('', () => (a => a.foo), 1) : any
|
||||
>r9 : string
|
||||
>f10('', () => (a => a.foo), 1) : ""
|
||||
>f10 : <T>(x: T, b: () => (a: T) => void, y: T) => T
|
||||
>'' : ""
|
||||
>() => (a => a.foo) : () => (a: "") => any
|
||||
|
||||
@@ -36,11 +36,11 @@ const FooComponent = (props: { foo: "A" | "B" | "C" }) => <span>{props.foo}</spa
|
||||
<FooComponent foo={"f"} />;
|
||||
><FooComponent foo={"f"} /> : JSX.Element
|
||||
>FooComponent : (props: { foo: "A" | "B" | "C"; }) => JSX.Element
|
||||
>foo : string
|
||||
>foo : "f"
|
||||
>"f" : "f"
|
||||
|
||||
<FooComponent foo="f" />;
|
||||
><FooComponent foo="f" /> : JSX.Element
|
||||
>FooComponent : (props: { foo: "A" | "B" | "C"; }) => JSX.Element
|
||||
>foo : string
|
||||
>foo : "f"
|
||||
|
||||
@@ -95,8 +95,8 @@ const b3 = <MainButton {...{goTo:"home"}} extra />; // goTo has type"home" | "c
|
||||
>b3 : JSX.Element
|
||||
><MainButton {...{goTo:"home"}} extra /> : JSX.Element
|
||||
>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; }
|
||||
>{goTo:"home"} : { goTo: string; }
|
||||
>goTo : string
|
||||
>{goTo:"home"} : { goTo: "home"; }
|
||||
>goTo : "home"
|
||||
>"home" : "home"
|
||||
>extra : true
|
||||
|
||||
@@ -104,7 +104,7 @@ const b4 = <MainButton goTo="home" extra />; // goTo has type "home" | "contact
|
||||
>b4 : JSX.Element
|
||||
><MainButton goTo="home" extra /> : JSX.Element
|
||||
>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; }
|
||||
>goTo : string
|
||||
>goTo : "home"
|
||||
>extra : true
|
||||
|
||||
export function NoOverload(buttonProps: ButtonProps): JSX.Element { return undefined }
|
||||
@@ -138,8 +138,8 @@ const d1 = <NoOverload1 {...{goTo:"home"}} extra />; // goTo has type "home" |
|
||||
>d1 : JSX.Element
|
||||
><NoOverload1 {...{goTo:"home"}} extra /> : JSX.Element
|
||||
>NoOverload1 : (linkProps: LinkProps) => JSX.Element
|
||||
>{goTo:"home"} : { goTo: string; }
|
||||
>goTo : string
|
||||
>{goTo:"home"} : { goTo: "home"; }
|
||||
>goTo : "home"
|
||||
>"home" : "home"
|
||||
>extra : true
|
||||
|
||||
@@ -152,7 +152,7 @@ function f6() {
|
||||
>x : (string | number)[] | boolean[]
|
||||
|
||||
x.push(99); // Error
|
||||
>x.push(99) : any
|
||||
>x.push(99) : number
|
||||
>x.push : ((...items: (string | number)[]) => number) | ((...items: boolean[]) => number)
|
||||
>x : (string | number)[] | boolean[]
|
||||
>push : ((...items: (string | number)[]) => number) | ((...items: boolean[]) => number)
|
||||
|
||||
@@ -27,7 +27,7 @@ function f1() {
|
||||
>cond : boolean
|
||||
|
||||
x = len(x);
|
||||
>x = len(x) : any
|
||||
>x = len(x) : number
|
||||
>x : string | number | boolean
|
||||
>len(x) : number
|
||||
>len : (s: string) => number
|
||||
@@ -58,7 +58,7 @@ function f2() {
|
||||
>x : string | number
|
||||
|
||||
x = len(x);
|
||||
>x = len(x) : any
|
||||
>x = len(x) : number
|
||||
>x : string | number | boolean
|
||||
>len(x) : number
|
||||
>len : (s: string) => number
|
||||
@@ -91,14 +91,14 @@ function g1() {
|
||||
>cond : boolean
|
||||
|
||||
x = foo(x);
|
||||
>x = foo(x) : any
|
||||
>x = foo(x) : never
|
||||
>x : string | number | boolean
|
||||
>foo(x) : any
|
||||
>foo(x) : never
|
||||
>foo : { (x: string): number; (x: number): string; }
|
||||
>x : string | number
|
||||
|
||||
x;
|
||||
>x : string | number | boolean
|
||||
>x : never
|
||||
}
|
||||
x;
|
||||
>x : string | number
|
||||
@@ -122,9 +122,9 @@ function g2() {
|
||||
>x : string | number
|
||||
|
||||
x = foo(x);
|
||||
>x = foo(x) : any
|
||||
>x = foo(x) : never
|
||||
>x : string | number | boolean
|
||||
>foo(x) : any
|
||||
>foo(x) : never
|
||||
>foo : { (x: string): number; (x: number): string; }
|
||||
>x : string | number
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ function test1() {
|
||||
>cond : true
|
||||
|
||||
x = foo(x);
|
||||
>x = foo(x) : any
|
||||
>x = foo(x) : number
|
||||
>x : number | undefined
|
||||
>foo(x) : number
|
||||
>foo : (x: number) => number
|
||||
|
||||
@@ -11,8 +11,8 @@ var b = [1, ""];
|
||||
>"" : ""
|
||||
|
||||
var b1G = makeArray(1, ""); // any, no error
|
||||
>b1G : any
|
||||
>makeArray(1, "") : any
|
||||
>b1G : unknown[]
|
||||
>makeArray(1, "") : unknown[]
|
||||
>makeArray : <T>(items: T[]) => T[]
|
||||
>1 : 1
|
||||
>"" : ""
|
||||
|
||||
@@ -463,12 +463,12 @@ f14([2, ["abc", { x: 0 }]]);
|
||||
f14([2, ["abc", { y: false }]]); // Error, no x
|
||||
>f14([2, ["abc", { y: false }]]) : void
|
||||
>f14 : ([a, [b, { x, y: c }]]: [number, [string, { x: any; y?: boolean; }]]) => void
|
||||
>[2, ["abc", { y: false }]] : (number | (string | { y: boolean; })[])[]
|
||||
>[2, ["abc", { y: false }]] : [number, [string, { y: false; }]]
|
||||
>2 : 2
|
||||
>["abc", { y: false }] : (string | { y: boolean; })[]
|
||||
>["abc", { y: false }] : [string, { y: false; }]
|
||||
>"abc" : "abc"
|
||||
>{ y: false } : { y: boolean; }
|
||||
>y : boolean
|
||||
>{ y: false } : { y: false; }
|
||||
>y : false
|
||||
>false : false
|
||||
|
||||
module M {
|
||||
|
||||
@@ -6,6 +6,6 @@ declare function dec<T>(target: T): T;
|
||||
var F = @dec () => {
|
||||
>F : any
|
||||
> : any
|
||||
>dec () : any
|
||||
>dec () : unknown
|
||||
>dec : <T>(target: T) => T
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||
Type 'C' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts (1 errors) ====
|
||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts (2 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
class C {
|
||||
@dec method() {}
|
||||
~~~~
|
||||
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||
~~~~
|
||||
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||
!!! error TS1241: Type 'C' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
|
||||
}
|
||||
@@ -91,7 +91,7 @@ const bar = new Bar<Foo>();
|
||||
|
||||
// all 3 of the below should error on passing `true` for `"1"`
|
||||
bar.broken("a", "1", true); // was broken in the past - with 2nd argument incorrectly of type "1" | "2" | "3".
|
||||
>bar.broken("a", "1", true) : any
|
||||
>bar.broken("a", "1", true) : void
|
||||
>bar.broken : <K1 extends string | number, K2 extends keys2broken<Foo, K1>, V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
|
||||
>bar : Bar<Foo>
|
||||
>broken : <K1 extends string | number, K2 extends keys2broken<Foo, K1>, V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
|
||||
@@ -100,7 +100,7 @@ bar.broken("a", "1", true); // was broken in the past - with 2nd argument incorr
|
||||
>true : true
|
||||
|
||||
bar.working("a", "1", true); // ok - true is not allowed
|
||||
>bar.working("a", "1", true) : any
|
||||
>bar.working("a", "1", true) : void
|
||||
>bar.working : <K1 extends string | number, K2 extends keys2working<Foo, K1>, V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
|
||||
>bar : Bar<Foo>
|
||||
>working : <K1 extends string | number, K2 extends keys2working<Foo, K1>, V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
|
||||
@@ -109,7 +109,7 @@ bar.working("a", "1", true); // ok - true is not allowed
|
||||
>true : true
|
||||
|
||||
bar.workaround("a", "1", true); // ok - true is not allowed
|
||||
>bar.workaround("a", "1", true) : any
|
||||
>bar.workaround("a", "1", true) : void
|
||||
>bar.workaround : <K1 extends string | number, K2 extends Extract<Foo[K1] extends object ? keyof Foo[K1] : never, string>, V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
|
||||
>bar : Bar<Foo>
|
||||
>workaround : <K1 extends string | number, K2 extends Extract<Foo[K1] extends object ? keyof Foo[K1] : never, string>, V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,19): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(5,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(8,20): error TS2322: Type '3' is not assignable to type 'string'.
|
||||
@@ -8,11 +9,13 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(20,62): error TS2352: C
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: Cannot use namespace 'T' as a value.
|
||||
|
||||
|
||||
==== tests/cases/compiler/defaultArgsInFunctionExpressions.ts (8 errors) ====
|
||||
==== tests/cases/compiler/defaultArgsInFunctionExpressions.ts (9 errors) ====
|
||||
var f = function (a = 3) { return a; }; // Type should be (a?: number) => number
|
||||
var n: number = f(4);
|
||||
n = f();
|
||||
var s: string = f('');
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
s = f();
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
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,24): error TS2345: Argument of type '""' is not assignable to parameter of type '1'.
|
||||
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(9,27): error TS2339: Property 'length' does not exist on type 'number'.
|
||||
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(13,28): error TS2339: Property 'length' does not exist on type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts (3 errors) ====
|
||||
==== tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts (5 errors) ====
|
||||
var obj1: {};
|
||||
obj1.length;
|
||||
~~~~~~
|
||||
@@ -19,9 +21,13 @@ tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,24): error TS2345: Arg
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type '1'.
|
||||
var elementCount = result.length;
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'length' does not exist on type 'number'.
|
||||
|
||||
function concat2<T, U>(x: T, y: U) { return null; }
|
||||
var result2 = concat2(1, ""); // result2 will be number|string
|
||||
var elementCount2 = result.length;
|
||||
~~~~~~
|
||||
!!! error TS2339: Property 'length' does not exist on type 'number'.
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ function concat<T>(x: T, y: T): T { return null; }
|
||||
>null : null
|
||||
|
||||
var result = concat(1, ""); // error
|
||||
>result : any
|
||||
>concat(1, "") : any
|
||||
>result : number
|
||||
>concat(1, "") : 1
|
||||
>concat : <T>(x: T, y: T) => T
|
||||
>1 : 1
|
||||
>"" : ""
|
||||
@@ -31,7 +31,7 @@ var result = concat(1, ""); // error
|
||||
var elementCount = result.length;
|
||||
>elementCount : any
|
||||
>result.length : any
|
||||
>result : any
|
||||
>result : number
|
||||
>length : any
|
||||
|
||||
function concat2<T, U>(x: T, y: U) { return null; }
|
||||
@@ -50,7 +50,7 @@ var result2 = concat2(1, ""); // result2 will be number|string
|
||||
var elementCount2 = result.length;
|
||||
>elementCount2 : any
|
||||
>result.length : any
|
||||
>result : any
|
||||
>result : number
|
||||
>length : any
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ class Derived extends Base {
|
||||
}
|
||||
|
||||
var r = new Derived(); // error
|
||||
>r : any
|
||||
>new Derived() : any
|
||||
>r : Derived
|
||||
>new Derived() : Derived
|
||||
>Derived : typeof Derived
|
||||
|
||||
var r2 = new Derived(1);
|
||||
@@ -68,8 +68,8 @@ class D<T extends Date> extends Base2<T> {
|
||||
}
|
||||
|
||||
var d = new D(); // error
|
||||
>d : any
|
||||
>new D() : any
|
||||
>d : D<Date>
|
||||
>new D() : D<Date>
|
||||
>D : typeof D
|
||||
|
||||
var d2 = new D(new Date()); // ok
|
||||
|
||||
@@ -38,8 +38,8 @@ class Derived extends Base {
|
||||
}
|
||||
|
||||
var r = new Derived(); // error
|
||||
>r : any
|
||||
>new Derived() : any
|
||||
>r : Derived
|
||||
>new Derived() : Derived
|
||||
>Derived : typeof Derived
|
||||
|
||||
var r2 = new Derived(1);
|
||||
@@ -101,8 +101,8 @@ class D<T extends Date> extends Base2<T> {
|
||||
}
|
||||
|
||||
var d = new D(); // error
|
||||
>d : any
|
||||
>new D() : any
|
||||
>d : D<Date>
|
||||
>new D() : D<Date>
|
||||
>D : typeof D
|
||||
|
||||
var d2 = new D(new Date()); // ok
|
||||
|
||||
@@ -57,13 +57,13 @@ class Derived2 extends Derived {
|
||||
}
|
||||
|
||||
var r = new Derived(); // error
|
||||
>r : any
|
||||
>new Derived() : any
|
||||
>r : Derived
|
||||
>new Derived() : Derived
|
||||
>Derived : typeof Derived
|
||||
|
||||
var r2 = new Derived2(1); // error
|
||||
>r2 : any
|
||||
>new Derived2(1) : any
|
||||
>r2 : Derived2
|
||||
>new Derived2(1) : Derived2
|
||||
>Derived2 : typeof Derived2
|
||||
>1 : 1
|
||||
|
||||
@@ -130,13 +130,13 @@ class D2<T extends Date> extends D<T> {
|
||||
}
|
||||
|
||||
var d = new D2(); // error
|
||||
>d : any
|
||||
>new D2() : any
|
||||
>d : D2<Date>
|
||||
>new D2() : D2<Date>
|
||||
>D2 : typeof D2
|
||||
|
||||
var d2 = new D2(new Date()); // error
|
||||
>d2 : any
|
||||
>new D2(new Date()) : any
|
||||
>d2 : D2<Date>
|
||||
>new D2(new Date()) : D2<Date>
|
||||
>D2 : typeof D2
|
||||
>new Date() : Date
|
||||
>Date : DateConstructor
|
||||
|
||||
@@ -54,7 +54,7 @@ a1([1, 2, [["world"]]]);
|
||||
a1([1, 2, [["world"]], 3]);
|
||||
>a1([1, 2, [["world"]], 3]) : void
|
||||
>a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void
|
||||
>[1, 2, [["world"]], 3] : (number | string[][])[]
|
||||
>[1, 2, [["world"]], 3] : [number, number, string[][], number]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["world"]] : string[][]
|
||||
@@ -302,11 +302,11 @@ c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]
|
||||
c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]]
|
||||
>c5([1, 2, [["string"]], false, true]) : void
|
||||
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
|
||||
>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["string"]] : string[][]
|
||||
>["string"] : string[]
|
||||
>[["string"]] : [[string]]
|
||||
>["string"] : [string]
|
||||
>"string" : "string"
|
||||
>false : false
|
||||
>true : true
|
||||
|
||||
@@ -54,7 +54,7 @@ a1([1, 2, [["world"]]]);
|
||||
a1([1, 2, [["world"]], 3]);
|
||||
>a1([1, 2, [["world"]], 3]) : void
|
||||
>a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void
|
||||
>[1, 2, [["world"]], 3] : (number | string[][])[]
|
||||
>[1, 2, [["world"]], 3] : [number, number, string[][], number]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["world"]] : string[][]
|
||||
@@ -302,11 +302,11 @@ c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]
|
||||
c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]]
|
||||
>c5([1, 2, [["string"]], false, true]) : void
|
||||
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
|
||||
>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["string"]] : string[][]
|
||||
>["string"] : string[]
|
||||
>[["string"]] : [[string]]
|
||||
>["string"] : [string]
|
||||
>"string" : "string"
|
||||
>false : false
|
||||
>true : true
|
||||
|
||||
@@ -56,7 +56,7 @@ a1([1, 2, [["world"]]]);
|
||||
a1([1, 2, [["world"]], 3]);
|
||||
>a1([1, 2, [["world"]], 3]) : void
|
||||
>a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void
|
||||
>[1, 2, [["world"]], 3] : (number | string[][])[]
|
||||
>[1, 2, [["world"]], 3] : [number, number, string[][], number]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["world"]] : string[][]
|
||||
@@ -285,11 +285,11 @@ c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]
|
||||
c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]]
|
||||
>c5([1, 2, [["string"]], false, true]) : void
|
||||
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
|
||||
>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["string"]] : string[][]
|
||||
>["string"] : string[]
|
||||
>[["string"]] : [[string]]
|
||||
>["string"] : [string]
|
||||
>"string" : "string"
|
||||
>false : false
|
||||
>true : true
|
||||
|
||||
@@ -13,7 +13,7 @@ function a0([a, b, [[c]]]: [number, number, string[][]]) { }
|
||||
a0([1, "string", [["world"]]); // Error
|
||||
>a0([1, "string", [["world"]]) : void
|
||||
>a0 : ([a, b, [[c]]]: [number, number, string[][]]) => void
|
||||
>[1, "string", [["world"]] : (string | number | string[][])[]
|
||||
>[1, "string", [["world"]] : [number, string, string[][]]
|
||||
>1 : 1
|
||||
>"string" : "string"
|
||||
>[["world"]] : string[][]
|
||||
@@ -23,7 +23,7 @@ a0([1, "string", [["world"]]); // Error
|
||||
a0([1, 2, [["world"]], "string"]); // Error
|
||||
>a0([1, 2, [["world"]], "string"]) : void
|
||||
>a0 : ([a, b, [[c]]]: [number, number, string[][]]) => void
|
||||
>[1, 2, [["world"]], "string"] : (string | number | string[][])[]
|
||||
>[1, 2, [["world"]], "string"] : [number, number, string[][], string]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["world"]] : string[][]
|
||||
@@ -183,7 +183,7 @@ c3({ b: true }); // Error, implied type is { b: number|string }.
|
||||
c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]]
|
||||
>c5([1, 2, false, true]) : void
|
||||
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
>[1, 2, false, true] : (number | boolean)[]
|
||||
>[1, 2, false, true] : [number, number, boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>false : false
|
||||
@@ -192,11 +192,11 @@ c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]]
|
||||
c6([1, 2, [["string"]]]); // Error, implied type is [any, any, [[number]]] // Use initializer
|
||||
>c6([1, 2, [["string"]]]) : void
|
||||
>c6 : ([a, b, [[c]]]: [any, any, [[number?]]]) => void
|
||||
>[1, 2, [["string"]]] : (number | string[][])[]
|
||||
>[1, 2, [["string"]]] : [number, number, [[string]]]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["string"]] : string[][]
|
||||
>["string"] : string[]
|
||||
>[["string"]] : [[string]]
|
||||
>["string"] : [string]
|
||||
>"string" : "string"
|
||||
|
||||
// A parameter can be marked optional by following its name or binding pattern with a question mark (?)
|
||||
|
||||
@@ -85,11 +85,11 @@ a1(...array);
|
||||
a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]]
|
||||
>a9([1, 2, [["string"]], false, true]) : void
|
||||
>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
|
||||
>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["string"]] : string[][]
|
||||
>["string"] : string[]
|
||||
>[["string"]] : [[string]]
|
||||
>["string"] : [string]
|
||||
>"string" : "string"
|
||||
>false : false
|
||||
>true : true
|
||||
@@ -109,7 +109,7 @@ a10([1, 2, [["string"]], false, true]); // Parameter type is any[]
|
||||
a10([1, 2, 3, false, true]); // Parameter type is any[]
|
||||
>a10([1, 2, 3, false, true]) : void
|
||||
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
|
||||
>[1, 2, 3, false, true] : (number | boolean)[]
|
||||
>[1, 2, 3, false, true] : [number, number, number, boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>3 : 3
|
||||
@@ -119,7 +119,7 @@ a10([1, 2, 3, false, true]); // Parameter type is any[]
|
||||
a10([1, 2]); // Parameter type is any[]
|
||||
>a10([1, 2]) : void
|
||||
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
|
||||
>[1, 2] : number[]
|
||||
>[1, 2] : [number, number]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
|
||||
@@ -85,11 +85,11 @@ a1(...array);
|
||||
a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]]
|
||||
>a9([1, 2, [["string"]], false, true]) : void
|
||||
>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
|
||||
>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["string"]] : string[][]
|
||||
>["string"] : string[]
|
||||
>[["string"]] : [[string]]
|
||||
>["string"] : [string]
|
||||
>"string" : "string"
|
||||
>false : false
|
||||
>true : true
|
||||
@@ -109,7 +109,7 @@ a10([1, 2, [["string"]], false, true]); // Parameter type is any[]
|
||||
a10([1, 2, 3, false, true]); // Parameter type is any[]
|
||||
>a10([1, 2, 3, false, true]) : void
|
||||
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
|
||||
>[1, 2, 3, false, true] : (number | boolean)[]
|
||||
>[1, 2, 3, false, true] : [number, number, number, boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>3 : 3
|
||||
@@ -119,7 +119,7 @@ a10([1, 2, 3, false, true]); // Parameter type is any[]
|
||||
a10([1, 2]); // Parameter type is any[]
|
||||
>a10([1, 2]) : void
|
||||
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
|
||||
>[1, 2] : number[]
|
||||
>[1, 2] : [number, number]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
|
||||
@@ -85,11 +85,11 @@ a1(...array);
|
||||
a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]]
|
||||
>a9([1, 2, [["string"]], false, true]) : void
|
||||
>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
|
||||
>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>[["string"]] : string[][]
|
||||
>["string"] : string[]
|
||||
>[["string"]] : [[string]]
|
||||
>["string"] : [string]
|
||||
>"string" : "string"
|
||||
>false : false
|
||||
>true : true
|
||||
@@ -109,7 +109,7 @@ a10([1, 2, [["string"]], false, true]); // Parameter type is any[]
|
||||
a10([1, 2, 3, false, true]); // Parameter type is any[]
|
||||
>a10([1, 2, 3, false, true]) : void
|
||||
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
|
||||
>[1, 2, 3, false, true] : (number | boolean)[]
|
||||
>[1, 2, 3, false, true] : [number, number, number, boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>3 : 3
|
||||
@@ -119,7 +119,7 @@ a10([1, 2, 3, false, true]); // Parameter type is any[]
|
||||
a10([1, 2]); // Parameter type is any[]
|
||||
>a10([1, 2]) : void
|
||||
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
|
||||
>[1, 2] : number[]
|
||||
>[1, 2] : [number, number]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ a1(...array2); // Error parameter type is (number|string)[]
|
||||
a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]]
|
||||
>a5([1, 2, "string", false, true]) : void
|
||||
>a5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
>[1, 2, "string", false, true] : (string | number | boolean)[]
|
||||
>[1, 2, "string", false, true] : [number, number, string, boolean, boolean]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>"string" : "string"
|
||||
@@ -79,7 +79,7 @@ a5([1, 2, "string", false, true]); // Error, parameter type is [any, any,
|
||||
a5([1, 2]); // Error, parameter type is [any, any, [[any]]]
|
||||
>a5([1, 2]) : void
|
||||
>a5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
|
||||
>[1, 2] : number[]
|
||||
>[1, 2] : [number, number]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ d3({ y: new SubClass() });
|
||||
|
||||
// Error
|
||||
d3({ y: new Class() });
|
||||
>d3({ y: new Class() }) : any
|
||||
>d3({ y: new Class() }) : void
|
||||
>d3 : <T extends D>({ y }: { y: D; }) => void
|
||||
>{ y: new Class() } : { y: Class; }
|
||||
>y : Class
|
||||
@@ -164,19 +164,19 @@ d3({ y: new Class() });
|
||||
>Class : typeof Class
|
||||
|
||||
d3({});
|
||||
>d3({}) : any
|
||||
>d3({}) : void
|
||||
>d3 : <T extends D>({ y }: { y: D; }) => void
|
||||
>{} : {}
|
||||
|
||||
d3({ y: 1 });
|
||||
>d3({ y: 1 }) : any
|
||||
>d3({ y: 1 }) : void
|
||||
>d3 : <T extends D>({ y }: { y: D; }) => void
|
||||
>{ y: 1 } : { y: number; }
|
||||
>y : number
|
||||
>1 : 1
|
||||
|
||||
d3({ y: "world" });
|
||||
>d3({ y: "world" }) : any
|
||||
>d3({ y: "world" }) : void
|
||||
>d3 : <T extends D>({ y }: { y: D; }) => void
|
||||
>{ y: "world" } : { y: string; }
|
||||
>y : string
|
||||
|
||||
@@ -49,22 +49,22 @@ test({ method: 'x', nested: { p: 'a' } })
|
||||
test({ method: 'z', nested: { p: 'b' } })
|
||||
>test({ method: 'z', nested: { p: 'b' } }) : void
|
||||
>test : ({ method, nested: { p } }: { method?: "x" | "y"; nested?: { p: "a" | "b"; }; }) => void
|
||||
>{ method: 'z', nested: { p: 'b' } } : { method: string; nested: { p: string; }; }
|
||||
>method : string
|
||||
>{ method: 'z', nested: { p: 'b' } } : { method: "z"; nested: { p: "b"; }; }
|
||||
>method : "z"
|
||||
>'z' : "z"
|
||||
>nested : { p: string; }
|
||||
>{ p: 'b' } : { p: string; }
|
||||
>p : string
|
||||
>nested : { p: "b"; }
|
||||
>{ p: 'b' } : { p: "b"; }
|
||||
>p : "b"
|
||||
>'b' : "b"
|
||||
|
||||
test({ method: 'one', nested: { p: 'a' } })
|
||||
>test({ method: 'one', nested: { p: 'a' } }) : void
|
||||
>test : ({ method, nested: { p } }: { method?: "x" | "y"; nested?: { p: "a" | "b"; }; }) => void
|
||||
>{ method: 'one', nested: { p: 'a' } } : { method: string; nested: { p: string; }; }
|
||||
>method : string
|
||||
>{ method: 'one', nested: { p: 'a' } } : { method: "one"; nested: { p: "a"; }; }
|
||||
>method : "one"
|
||||
>'one' : "one"
|
||||
>nested : { p: string; }
|
||||
>{ p: 'a' } : { p: string; }
|
||||
>p : string
|
||||
>nested : { p: "a"; }
|
||||
>{ p: 'a' } : { p: "a"; }
|
||||
>p : "a"
|
||||
>'a' : "a"
|
||||
|
||||
@@ -57,9 +57,15 @@ var [x_a, x_b, x_c] = [x.getA(), x.getB(), x.getC()];
|
||||
>x_a : Symbol(x_a, Decl(destructuringParameterProperties2.ts, 21, 5))
|
||||
>x_b : Symbol(x_b, Decl(destructuringParameterProperties2.ts, 21, 9))
|
||||
>x_c : Symbol(x_c, Decl(destructuringParameterProperties2.ts, 21, 14))
|
||||
>x.getA : Symbol(C1.getA, Decl(destructuringParameterProperties2.ts, 5, 5))
|
||||
>x : Symbol(x, Decl(destructuringParameterProperties2.ts, 20, 3))
|
||||
>getA : Symbol(C1.getA, Decl(destructuringParameterProperties2.ts, 5, 5))
|
||||
>x.getB : Symbol(C1.getB, Decl(destructuringParameterProperties2.ts, 9, 5))
|
||||
>x : Symbol(x, Decl(destructuringParameterProperties2.ts, 20, 3))
|
||||
>getB : Symbol(C1.getB, Decl(destructuringParameterProperties2.ts, 9, 5))
|
||||
>x.getC : Symbol(C1.getC, Decl(destructuringParameterProperties2.ts, 13, 5))
|
||||
>x : Symbol(x, Decl(destructuringParameterProperties2.ts, 20, 3))
|
||||
>getC : Symbol(C1.getC, Decl(destructuringParameterProperties2.ts, 13, 5))
|
||||
|
||||
var y = new C1(10, [0, "", true]);
|
||||
>y : Symbol(y, Decl(destructuringParameterProperties2.ts, 23, 3))
|
||||
|
||||
@@ -71,11 +71,11 @@ class C1 {
|
||||
}
|
||||
|
||||
var x = new C1(undefined, [0, undefined, ""]);
|
||||
>x : any
|
||||
>new C1(undefined, [0, undefined, ""]) : any
|
||||
>x : C1
|
||||
>new C1(undefined, [0, undefined, ""]) : C1
|
||||
>C1 : typeof C1
|
||||
>undefined : undefined
|
||||
>[0, undefined, ""] : (string | number)[]
|
||||
>[0, undefined, ""] : [number, undefined, string]
|
||||
>0 : 0
|
||||
>undefined : undefined
|
||||
>"" : ""
|
||||
@@ -86,17 +86,17 @@ var [x_a, x_b, x_c] = [x.getA(), x.getB(), x.getC()];
|
||||
>x_c : any
|
||||
>[x.getA(), x.getB(), x.getC()] : [any, any, any]
|
||||
>x.getA() : any
|
||||
>x.getA : any
|
||||
>x : any
|
||||
>getA : any
|
||||
>x.getA : () => any
|
||||
>x : C1
|
||||
>getA : () => any
|
||||
>x.getB() : any
|
||||
>x.getB : any
|
||||
>x : any
|
||||
>getB : any
|
||||
>x.getB : () => any
|
||||
>x : C1
|
||||
>getB : () => any
|
||||
>x.getC() : any
|
||||
>x.getC : any
|
||||
>x : any
|
||||
>getC : any
|
||||
>x.getC : () => any
|
||||
>x : C1
|
||||
>getC : () => any
|
||||
|
||||
var y = new C1(10, [0, "", true]);
|
||||
>y : C1
|
||||
|
||||
@@ -11,9 +11,14 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(1
|
||||
Object literal may only specify known properties, and 'x1' does not exist in type 'ObjType1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,47): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,51): error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,39): error TS2339: Property 'x1' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,45): error TS2339: Property 'x2' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,51): error TS2339: Property 'x3' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,57): error TS2339: Property 'y' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,62): error TS2339: Property 'z' does not exist on type 'C1'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts (12 errors) ====
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts (17 errors) ====
|
||||
type ObjType1 = { x: number; y: string; z: boolean }
|
||||
type TupleType1 = [ObjType1, number, string]
|
||||
|
||||
@@ -50,4 +55,14 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(1
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
|
||||
var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
|
||||
~~
|
||||
!!! error TS2339: Property 'x1' does not exist on type 'C1'.
|
||||
~~
|
||||
!!! error TS2339: Property 'x2' does not exist on type 'C1'.
|
||||
~~
|
||||
!!! error TS2339: Property 'x3' does not exist on type 'C1'.
|
||||
~
|
||||
!!! error TS2339: Property 'y' does not exist on type 'C1'.
|
||||
~
|
||||
!!! error TS2339: Property 'z' does not exist on type 'C1'.
|
||||
@@ -55,10 +55,10 @@ class C1 {
|
||||
}
|
||||
|
||||
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false]);
|
||||
>a : any
|
||||
>new C1([{ x1: 10, x2: "", x3: true }, "", false]) : any
|
||||
>a : C1
|
||||
>new C1([{ x1: 10, x2: "", x3: true }, "", false]) : C1
|
||||
>C1 : typeof C1
|
||||
>[{ x1: 10, x2: "", x3: true }, "", false] : (string | boolean | { x1: number; x2: string; x3: boolean; })[]
|
||||
>[{ x1: 10, x2: "", x3: true }, "", false] : [{ x1: number; x2: string; x3: boolean; }, string, boolean]
|
||||
>{ x1: 10, x2: "", x3: true } : { x1: number; x2: string; x3: boolean; }
|
||||
>x1 : number
|
||||
>10 : 10
|
||||
@@ -77,18 +77,18 @@ var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
|
||||
>a_z : any
|
||||
>[a.x1, a.x2, a.x3, a.y, a.z] : [any, any, any, any, any]
|
||||
>a.x1 : any
|
||||
>a : any
|
||||
>a : C1
|
||||
>x1 : any
|
||||
>a.x2 : any
|
||||
>a : any
|
||||
>a : C1
|
||||
>x2 : any
|
||||
>a.x3 : any
|
||||
>a : any
|
||||
>a : C1
|
||||
>x3 : any
|
||||
>a.y : any
|
||||
>a : any
|
||||
>a : C1
|
||||
>y : any
|
||||
>a.z : any
|
||||
>a : any
|
||||
>a : C1
|
||||
>z : any
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
tests/cases/compiler/destructuringTuple.ts(11,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
tests/cases/compiler/destructuringTuple.ts(11,7): error TS2461: Type 'number' is not an array type.
|
||||
tests/cases/compiler/destructuringTuple.ts(11,48): error TS2769: No overload matches this call.
|
||||
Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
|
||||
Type 'never[]' is not assignable to type 'number'.
|
||||
Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
|
||||
Type 'never[]' is not assignable to type '[]'.
|
||||
Types of property 'length' are incompatible.
|
||||
Type 'number' is not assignable to type '0'.
|
||||
tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload matches this call.
|
||||
Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
|
||||
Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
|
||||
@@ -6,7 +13,7 @@ tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload mat
|
||||
Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/destructuringTuple.ts (2 errors) ====
|
||||
==== tests/cases/compiler/destructuringTuple.ts (3 errors) ====
|
||||
declare var tuple: [boolean, number, ...string[]];
|
||||
|
||||
const [a, b, c, ...rest] = tuple;
|
||||
@@ -18,8 +25,18 @@ tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload mat
|
||||
// Repros from #32140
|
||||
|
||||
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
|
||||
~~~~~
|
||||
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
|
||||
~~~~~~~
|
||||
!!! error TS2461: Type 'number' is not an array type.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2769: No overload matches this call.
|
||||
!!! error TS2769: Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
|
||||
!!! error TS2769: Type 'never[]' is not assignable to type 'number'.
|
||||
!!! error TS2769: Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
|
||||
!!! error TS2769: Type 'never[]' is not assignable to type '[]'.
|
||||
!!! error TS2769: Types of property 'length' are incompatible.
|
||||
!!! error TS2769: Type 'number' is not assignable to type '0'.
|
||||
!!! related TS6502 /.ts/lib.es5.d.ts:1350:24: The expected type comes from the return type of this signature.
|
||||
!!! related TS6502 /.ts/lib.es5.d.ts:1356:27: The expected type comes from the return type of this signature.
|
||||
~~
|
||||
!!! error TS2769: No overload matches this call.
|
||||
!!! error TS2769: Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
|
||||
|
||||
@@ -23,23 +23,23 @@ declare var receiver: typeof tuple;
|
||||
// Repros from #32140
|
||||
|
||||
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
|
||||
>oops1 : undefined
|
||||
>[1, 2, 3].reduce((accu, el) => accu.concat(el), []) : []
|
||||
>oops1 : any
|
||||
>[1, 2, 3].reduce((accu, el) => accu.concat(el), []) : number
|
||||
>[1, 2, 3].reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>3 : 3
|
||||
>reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
|
||||
>(accu, el) => accu.concat(el) : (accu: [], el: number) => any
|
||||
>(accu, el) => accu.concat(el) : (accu: [], el: number) => never[]
|
||||
>accu : []
|
||||
>el : number
|
||||
>accu.concat(el) : any
|
||||
>accu.concat(el) : never[]
|
||||
>accu.concat : { (...items: ConcatArray<never>[]): never[]; (...items: ConcatArray<never>[]): never[]; }
|
||||
>accu : []
|
||||
>concat : { (...items: ConcatArray<never>[]): never[]; (...items: ConcatArray<never>[]): never[]; }
|
||||
>el : number
|
||||
>[] : []
|
||||
>[] : never[]
|
||||
|
||||
const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);
|
||||
>oops2 : number
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ foo({
|
||||
}, getNum(), [
|
||||
>getNum() : number
|
||||
>getNum : () => number
|
||||
>[ 1, 2, getNum] : (number | (() => number))[]
|
||||
>[ 1, 2, getNum] : [number, number, () => number]
|
||||
|
||||
1,
|
||||
>1 : 1
|
||||
|
||||
@@ -5,8 +5,8 @@ function f() {
|
||||
>f : () => void
|
||||
|
||||
var d1 = new derived();
|
||||
>d1 : any
|
||||
>new derived() : any
|
||||
>d1 : derived
|
||||
>new derived() : derived
|
||||
>derived : typeof derived
|
||||
|
||||
var d2 = new derived(4);
|
||||
|
||||
@@ -3,8 +3,8 @@ import foo = require("./foo_0");
|
||||
>foo : typeof foo
|
||||
|
||||
var x = new foo(true); // Should error
|
||||
>x : any
|
||||
>new foo(true) : any
|
||||
>x : foo<{ a: string; b: number; }>
|
||||
>new foo(true) : foo<{ a: string; b: number; }>
|
||||
>foo : typeof foo
|
||||
>true : true
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
tests/cases/compiler/extractInferenceImprovement.ts(26,26): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'never'.
|
||||
tests/cases/compiler/extractInferenceImprovement.ts(28,1): error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/extractInferenceImprovement.ts(28,26): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type '"first" | "second"'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/extractInferenceImprovement.ts (2 errors) ====
|
||||
==== tests/cases/compiler/extractInferenceImprovement.ts (3 errors) ====
|
||||
// repro mostly from https://github.com/Microsoft/TypeScript/issues/25065
|
||||
function getProperty2<T, K extends keyof T>(obj: T, key: Extract<K, string>): T[K] {
|
||||
return obj[key];
|
||||
@@ -33,6 +35,9 @@ tests/cases/compiler/extractInferenceImprovement.ts(28,26): error TS2345: Argume
|
||||
!!! error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'never'.
|
||||
|
||||
prop = getProperty3(obj, s);
|
||||
~~~~
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type '"first" | "second"'.
|
||||
|
||||
@@ -65,17 +65,17 @@ prop = getProperty3(obj, 'first');
|
||||
|
||||
// Should fail
|
||||
prop = getProperty2(obj, s);
|
||||
>prop = getProperty2(obj, s) : any
|
||||
>prop = getProperty2(obj, s) : string
|
||||
>prop : string
|
||||
>getProperty2(obj, s) : any
|
||||
>getProperty2(obj, s) : string
|
||||
>getProperty2 : <T, K extends keyof T>(obj: T, key: Extract<K, string>) => T[K]
|
||||
>obj : StrNum
|
||||
>s : unique symbol
|
||||
|
||||
prop = getProperty3(obj, s);
|
||||
>prop = getProperty3(obj, s) : any
|
||||
>prop = getProperty3(obj, s) : string | number
|
||||
>prop : string
|
||||
>getProperty3(obj, s) : any
|
||||
>getProperty3(obj, s) : string | number
|
||||
>getProperty3 : <T, K extends Extract<keyof T, string>>(obj: T, key: K) => T[K]
|
||||
>obj : StrNum
|
||||
>s : unique symbol
|
||||
|
||||
@@ -5,7 +5,7 @@ function bar<T>(item1: T, item2: T) { }
|
||||
>item2 : T
|
||||
|
||||
bar(1, ""); // Should be ok
|
||||
>bar(1, "") : any
|
||||
>bar(1, "") : void
|
||||
>bar : <T>(item1: T, item2: T) => void
|
||||
>1 : 1
|
||||
>"" : ""
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
tests/cases/compiler/fixingTypeParametersRepeatedly2.ts(11,32): error TS2741: Property 'toBase' is missing in type 'Base' but required in type 'Derived'.
|
||||
tests/cases/compiler/fixingTypeParametersRepeatedly2.ts(17,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'result' must be of type 'Derived', but here has type 'Base'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/fixingTypeParametersRepeatedly2.ts (1 errors) ====
|
||||
==== tests/cases/compiler/fixingTypeParametersRepeatedly2.ts (2 errors) ====
|
||||
interface Base {
|
||||
baseProp;
|
||||
}
|
||||
@@ -22,4 +23,7 @@ tests/cases/compiler/fixingTypeParametersRepeatedly2.ts(11,32): error TS2741: Pr
|
||||
// The same error should be observed in both cases.
|
||||
declare function bar<T>(x: T, func: (p: T) => T): T;
|
||||
declare function bar<T>(x: T, func: (p: T) => T): T;
|
||||
var result = bar(derived, d => d.toBase());
|
||||
var result = bar(derived, d => d.toBase());
|
||||
~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'result' must be of type 'Derived', but here has type 'Base'.
|
||||
!!! related TS6203 tests/cases/compiler/fixingTypeParametersRepeatedly2.ts:11:5: 'result' was also declared here.
|
||||
@@ -18,8 +18,8 @@ declare function foo<T>(x: T, func: (p: T) => T): T;
|
||||
>p : T
|
||||
|
||||
var result = foo(derived, d => d.toBase());
|
||||
>result : any
|
||||
>foo(derived, d => d.toBase()) : any
|
||||
>result : Derived
|
||||
>foo(derived, d => d.toBase()) : Derived
|
||||
>foo : <T>(x: T, func: (p: T) => T) => T
|
||||
>derived : Derived
|
||||
>d => d.toBase() : (d: Derived) => Base
|
||||
@@ -44,7 +44,7 @@ declare function bar<T>(x: T, func: (p: T) => T): T;
|
||||
>p : T
|
||||
|
||||
var result = bar(derived, d => d.toBase());
|
||||
>result : any
|
||||
>result : Derived
|
||||
>bar(derived, d => d.toBase()) : Base
|
||||
>bar : { <T>(x: T, func: (p: T) => T): T; <T>(x: T, func: (p: T) => T): T; }
|
||||
>derived : Derived
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of39.ts ===
|
||||
var map = new Map([["", true], ["", 0]]);
|
||||
>map : any
|
||||
>new Map([["", true], ["", 0]]) : any
|
||||
>map : Map<string, boolean>
|
||||
>new Map([["", true], ["", 0]]) : Map<string, boolean>
|
||||
>Map : MapConstructor
|
||||
>[["", true], ["", 0]] : ((string | boolean)[] | (string | number)[])[]
|
||||
>["", true] : (string | boolean)[]
|
||||
>[["", true], ["", 0]] : ([string, number] | [string, true])[]
|
||||
>["", true] : [string, true]
|
||||
>"" : ""
|
||||
>true : true
|
||||
>["", 0] : (string | number)[]
|
||||
>["", 0] : [string, number]
|
||||
>"" : ""
|
||||
>0 : 0
|
||||
|
||||
for (var [k, v] of map) {
|
||||
>k : any
|
||||
>v : any
|
||||
>map : any
|
||||
>k : string
|
||||
>v : boolean
|
||||
>map : Map<string, boolean>
|
||||
|
||||
k;
|
||||
>k : any
|
||||
>k : string
|
||||
|
||||
v;
|
||||
>v : any
|
||||
>v : boolean
|
||||
}
|
||||
@@ -23,7 +23,7 @@ function call0(p: A | B) {
|
||||
>p : A | B
|
||||
|
||||
p.a("s"); // Error
|
||||
>p.a("s") : any
|
||||
>p.a("s") : string
|
||||
>p.a : ((x: number) => string) | ((x: boolean) => string)
|
||||
>p : A | B
|
||||
>a : ((x: number) => string) | ((x: boolean) => string)
|
||||
@@ -35,7 +35,7 @@ function callN<T extends A | B>(p: T) {
|
||||
>p : T
|
||||
|
||||
p.a("s"); // Error
|
||||
>p.a("s") : any
|
||||
>p.a("s") : string
|
||||
>p.a : ((x: number) => string) | ((x: boolean) => string)
|
||||
>p : T
|
||||
>a : ((x: number) => string) | ((x: boolean) => string)
|
||||
@@ -48,12 +48,12 @@ function callN<T extends A | B>(p: T) {
|
||||
>a : ((x: number) => string) | ((x: boolean) => string)
|
||||
|
||||
a(""); // Error
|
||||
>a("") : any
|
||||
>a("") : string
|
||||
>a : T["a"]
|
||||
>"" : ""
|
||||
|
||||
a("", "", "", ""); // Error
|
||||
>a("", "", "", "") : any
|
||||
>a("", "", "", "") : string
|
||||
>a : T["a"]
|
||||
>"" : ""
|
||||
>"" : ""
|
||||
|
||||
@@ -7,18 +7,18 @@ function foo<T extends Function>(x: T): T { return x; }
|
||||
>x : T
|
||||
|
||||
foo(1);
|
||||
>foo(1) : any
|
||||
>foo(1) : Function
|
||||
>foo : <T extends Function>(x: T) => T
|
||||
>1 : 1
|
||||
|
||||
foo(() => { }, 1);
|
||||
>foo(() => { }, 1) : any
|
||||
>foo(() => { }, 1) : () => void
|
||||
>foo : <T extends Function>(x: T) => T
|
||||
>() => { } : () => void
|
||||
>1 : 1
|
||||
|
||||
foo(1, () => { });
|
||||
>foo(1, () => { }) : any
|
||||
>foo(1, () => { }) : Function
|
||||
>foo : <T extends Function>(x: T) => T
|
||||
>1 : 1
|
||||
>() => { } : () => void
|
||||
@@ -52,29 +52,29 @@ var b2: { new <T>(x: T): T };
|
||||
>x : T
|
||||
|
||||
var r = foo2(new Function());
|
||||
>r : any
|
||||
>foo2(new Function()) : any
|
||||
>r : (x: string) => string
|
||||
>foo2(new Function()) : (x: string) => string
|
||||
>foo2 : <T extends (x: string) => string>(x: T) => T
|
||||
>new Function() : Function
|
||||
>Function : FunctionConstructor
|
||||
|
||||
var r2 = foo2((x: string[]) => x);
|
||||
>r2 : any
|
||||
>foo2((x: string[]) => x) : any
|
||||
>r2 : (x: string) => string
|
||||
>foo2((x: string[]) => x) : (x: string) => string
|
||||
>foo2 : <T extends (x: string) => string>(x: T) => T
|
||||
>(x: string[]) => x : (x: string[]) => string[]
|
||||
>x : string[]
|
||||
>x : string[]
|
||||
|
||||
var r6 = foo2(C);
|
||||
>r6 : any
|
||||
>foo2(C) : any
|
||||
>r6 : (x: string) => string
|
||||
>foo2(C) : (x: string) => string
|
||||
>foo2 : <T extends (x: string) => string>(x: T) => T
|
||||
>C : typeof C
|
||||
|
||||
var r7 = foo2(b);
|
||||
>r7 : any
|
||||
>foo2(b) : any
|
||||
>r7 : (x: string) => string
|
||||
>foo2(b) : (x: string) => string
|
||||
>foo2 : <T extends (x: string) => string>(x: T) => T
|
||||
>b : new (x: string) => string
|
||||
|
||||
@@ -87,8 +87,8 @@ var r8 = foo2(<U>(x: U) => x); // no error expected
|
||||
>x : U
|
||||
|
||||
var r11 = foo2(<U, V>(x: U, y: V) => x);
|
||||
>r11 : any
|
||||
>foo2(<U, V>(x: U, y: V) => x) : any
|
||||
>r11 : (x: string) => string
|
||||
>foo2(<U, V>(x: U, y: V) => x) : (x: string) => string
|
||||
>foo2 : <T extends (x: string) => string>(x: T) => T
|
||||
><U, V>(x: U, y: V) => x : <U, V>(x: U, y: V) => U
|
||||
>x : U
|
||||
@@ -96,14 +96,14 @@ var r11 = foo2(<U, V>(x: U, y: V) => x);
|
||||
>x : U
|
||||
|
||||
var r13 = foo2(C2);
|
||||
>r13 : any
|
||||
>foo2(C2) : any
|
||||
>r13 : (x: string) => string
|
||||
>foo2(C2) : (x: string) => string
|
||||
>foo2 : <T extends (x: string) => string>(x: T) => T
|
||||
>C2 : typeof C2
|
||||
|
||||
var r14 = foo2(b2);
|
||||
>r14 : any
|
||||
>foo2(b2) : any
|
||||
>r14 : (x: string) => string
|
||||
>foo2(b2) : (x: string) => string
|
||||
>foo2 : <T extends (x: string) => string>(x: T) => T
|
||||
>b2 : new <T>(x: T) => T
|
||||
|
||||
@@ -114,8 +114,8 @@ var f2: F2;
|
||||
>f2 : F2
|
||||
|
||||
var r16 = foo2(f2);
|
||||
>r16 : any
|
||||
>foo2(f2) : any
|
||||
>r16 : (x: string) => string
|
||||
>foo2(f2) : (x: string) => string
|
||||
>foo2 : <T extends (x: string) => string>(x: T) => T
|
||||
>f2 : F2
|
||||
|
||||
@@ -125,12 +125,12 @@ function fff<T extends { (): void }, U extends T>(x: T, y: U) {
|
||||
>y : U
|
||||
|
||||
foo2(x);
|
||||
>foo2(x) : any
|
||||
>foo2(x) : (x: string) => string
|
||||
>foo2 : <T extends (x: string) => string>(x: T) => T
|
||||
>x : T
|
||||
|
||||
foo2(y);
|
||||
>foo2(y) : any
|
||||
>foo2(y) : (x: string) => string
|
||||
>foo2 : <T extends (x: string) => string>(x: T) => T
|
||||
>y : U
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ function foo(bar?: string): any { return "" };
|
||||
>"" : ""
|
||||
|
||||
var x = foo(5);
|
||||
>x : any
|
||||
>foo(5) : any
|
||||
>x : never
|
||||
>foo(5) : never
|
||||
>foo : { (): string; (bar: string): number; }
|
||||
>5 : 5
|
||||
|
||||
@@ -13,8 +13,8 @@ function foo(bar: any): any { return bar };
|
||||
>bar : any
|
||||
|
||||
var x = foo(true);
|
||||
>x : any
|
||||
>foo(true) : any
|
||||
>x : never
|
||||
>foo(true) : never
|
||||
>foo : { (bar: string): string; (bar: number): number; }
|
||||
>true : true
|
||||
|
||||
@@ -12,8 +12,8 @@ function foo(bar?:any):any{ return '' }
|
||||
>'' : ""
|
||||
|
||||
var x = foo(5);
|
||||
>x : any
|
||||
>foo(5) : any
|
||||
>x : never
|
||||
>foo(5) : never
|
||||
>foo : { (): string; (bar: string): number; }
|
||||
>5 : 5
|
||||
|
||||
@@ -13,7 +13,7 @@ function foo(bar:any):any{ return bar }
|
||||
>bar : any
|
||||
|
||||
var x = foo();
|
||||
>x : any
|
||||
>foo() : any
|
||||
>x : never
|
||||
>foo() : never
|
||||
>foo : { (bar: string): string; (bar: number): number; }
|
||||
|
||||
@@ -16,7 +16,7 @@ function foo(bar:{a:any;}):any{ return bar }
|
||||
>bar : { a: any; }
|
||||
|
||||
var x = foo();
|
||||
>x : any
|
||||
>foo() : any
|
||||
>x : never
|
||||
>foo() : never
|
||||
>foo : { (bar: { a: number; }): string; (bar: { a: boolean; }): number; }
|
||||
|
||||
@@ -16,7 +16,7 @@ function foo(bar:{a:any;}[]):any{ return bar }
|
||||
>bar : { a: any; }[]
|
||||
|
||||
var x = foo();
|
||||
>x : any
|
||||
>foo() : any
|
||||
>x : never
|
||||
>foo() : never
|
||||
>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; }
|
||||
|
||||
@@ -16,8 +16,8 @@ function foo(bar:{a:any;}[]):any{ return bar }
|
||||
>bar : { a: any; }[]
|
||||
|
||||
var x = foo([{a:'bar'}]);
|
||||
>x : any
|
||||
>foo([{a:'bar'}]) : any
|
||||
>x : never
|
||||
>foo([{a:'bar'}]) : never
|
||||
>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; }
|
||||
>[{a:'bar'}] : { a: string; }[]
|
||||
>{a:'bar'} : { a: string; }
|
||||
|
||||
@@ -16,8 +16,8 @@ function foo(bar:{a:any;}[]):any{ return bar }
|
||||
>bar : { a: any; }[]
|
||||
|
||||
var x = foo([{}]);
|
||||
>x : any
|
||||
>foo([{}]) : any
|
||||
>x : never
|
||||
>foo([{}]) : never
|
||||
>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; }
|
||||
>[{}] : {}[]
|
||||
>{} : {}
|
||||
|
||||
@@ -7,11 +7,11 @@ declare function f1<A, B, C, D = any>(): void;
|
||||
>f1 : { <A = any>(): void; <A, B, C, D = any>(): void; }
|
||||
|
||||
f1<number, number>();
|
||||
>f1<number, number>() : any
|
||||
>f1<number, number>() : void
|
||||
>f1 : { <A = any>(): void; <A, B, C, D = any>(): void; }
|
||||
|
||||
f1<number, number, number, number, number>();
|
||||
>f1<number, number, number, number, number>() : any
|
||||
>f1<number, number, number, number, number>() : void
|
||||
>f1 : { <A = any>(): void; <A, B, C, D = any>(): void; }
|
||||
|
||||
// Overloaded functions with no default type arguments
|
||||
@@ -22,11 +22,11 @@ declare function f2<A, B, C>(): void;
|
||||
>f2 : { <A>(): void; <A, B, C>(): void; }
|
||||
|
||||
f2<number, number>();
|
||||
>f2<number, number>() : any
|
||||
>f2<number, number>() : void
|
||||
>f2 : { <A>(): void; <A, B, C>(): void; }
|
||||
|
||||
f2<number, number, number, number>();
|
||||
>f2<number, number, number, number>() : any
|
||||
>f2<number, number, number, number>() : void
|
||||
>f2 : { <A>(): void; <A, B, C>(): void; }
|
||||
|
||||
// Overloaded non-generic functions
|
||||
@@ -38,7 +38,7 @@ declare function f3(a): void;
|
||||
>a : any
|
||||
|
||||
f3<number>();
|
||||
>f3<number>() : any
|
||||
>f3<number>() : void
|
||||
>f3 : { (): void; (a: any): void; }
|
||||
|
||||
// Generic function with default type parameters
|
||||
@@ -46,11 +46,11 @@ declare function f4<A, B, C = any>(): void;
|
||||
>f4 : <A, B, C = any>() => void
|
||||
|
||||
f4<number>();
|
||||
>f4<number>() : any
|
||||
>f4<number>() : void
|
||||
>f4 : <A, B, C = any>() => void
|
||||
|
||||
f4<number, number, number, number>();
|
||||
>f4<number, number, number, number>() : any
|
||||
>f4<number, number, number, number>() : void
|
||||
>f4 : <A, B, C = any>() => void
|
||||
|
||||
// Generic function with no default type arguments
|
||||
@@ -58,10 +58,10 @@ declare function f5<A, B>(): void;
|
||||
>f5 : <A, B>() => void
|
||||
|
||||
f5<number>();
|
||||
>f5<number>() : any
|
||||
>f5<number>() : void
|
||||
>f5 : <A, B>() => void
|
||||
|
||||
f5<number, number, number>();
|
||||
>f5<number, number, number>() : any
|
||||
>f5<number, number, number>() : void
|
||||
>f5 : <A, B>() => void
|
||||
|
||||
@@ -50,14 +50,14 @@ export interface State extends StrategicState {
|
||||
|
||||
export const Nothing: Strategy<State> = strategy("Nothing", function* (state: State) {
|
||||
>Nothing : Strategy<State>
|
||||
>strategy("Nothing", function* (state: State) { yield 1; return state;}) : any
|
||||
>strategy("Nothing", function* (state: State) { yield 1; return state;}) : (a: State) => IterableIterator<State>
|
||||
>strategy : <T extends StrategicState>(stratName: string, gen: (a: T) => IterableIterator<T>) => (a: T) => IterableIterator<T>
|
||||
>"Nothing" : "Nothing"
|
||||
>function* (state: State) { yield 1; return state;} : (state: State) => Generator<number, State, undefined>
|
||||
>state : State
|
||||
|
||||
yield 1;
|
||||
>yield 1 : any
|
||||
>yield 1 : undefined
|
||||
>1 : 1
|
||||
|
||||
return state;
|
||||
|
||||
@@ -27,11 +27,11 @@ declare var _: Underscore.Static;
|
||||
// No error, Call signatures of types '<T>(value: T) => T' and 'Underscore.Iterator<{}, boolean>' are compatible when instantiated with any.
|
||||
// Ideally, we would not have a generic signature here, because it should be instantiated with {} during inferential typing
|
||||
_.all([true, 1, null, 'yes'], _.identity);
|
||||
>_.all([true, 1, null, 'yes'], _.identity) : any
|
||||
>_.all([true, 1, null, 'yes'], _.identity) : boolean
|
||||
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
||||
>_ : Underscore.Static
|
||||
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
||||
>[true, 1, null, 'yes'] : (string | number | boolean)[]
|
||||
>[true, 1, null, 'yes'] : (string | number | true)[]
|
||||
>true : true
|
||||
>1 : 1
|
||||
>null : null
|
||||
|
||||
+8
-8
@@ -49,8 +49,8 @@ module m2 {
|
||||
>numPromise : Promise<number>
|
||||
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
>newPromise : any
|
||||
>numPromise.then(testFunction) : any
|
||||
>newPromise : Promise<string>
|
||||
>numPromise.then(testFunction) : Promise<string>
|
||||
>numPromise.then : <U>(cb: (x: number) => Promise<U>) => Promise<U>
|
||||
>numPromise : Promise<number>
|
||||
>then : <U>(cb: (x: number) => Promise<U>) => Promise<U>
|
||||
@@ -123,8 +123,8 @@ module m4 {
|
||||
>numPromise : Promise<number>
|
||||
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
>newPromise : any
|
||||
>numPromise.then(testFunction) : any
|
||||
>newPromise : Promise<string>
|
||||
>numPromise.then(testFunction) : Promise<string>
|
||||
>numPromise.then : { <U>(cb: (x: number) => Promise<U>): Promise<U>; <U>(cb: (x: number) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>; }
|
||||
>numPromise : Promise<number>
|
||||
>then : { <U>(cb: (x: number) => Promise<U>): Promise<U>; <U>(cb: (x: number) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>; }
|
||||
@@ -171,8 +171,8 @@ module m5 {
|
||||
>numPromise : Promise<number>
|
||||
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
>newPromise : any
|
||||
>numPromise.then(testFunction) : any
|
||||
>newPromise : Promise<string>
|
||||
>numPromise.then(testFunction) : Promise<string>
|
||||
>numPromise.then : { <U>(cb: (x: number) => Promise<U>): Promise<U>; <U>(cb: (x: number) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>; <U>(cb: (x: number) => Promise<U>, error?: (error: any) => U, progress?: (preservation: any) => void): Promise<U>; }
|
||||
>numPromise : Promise<number>
|
||||
>then : { <U>(cb: (x: number) => Promise<U>): Promise<U>; <U>(cb: (x: number) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>; <U>(cb: (x: number) => Promise<U>, error?: (error: any) => U, progress?: (preservation: any) => void): Promise<U>; }
|
||||
@@ -214,8 +214,8 @@ module m6 {
|
||||
>numPromise : Promise<number>
|
||||
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
>newPromise : any
|
||||
>numPromise.then(testFunction) : any
|
||||
>newPromise : Promise<boolean>
|
||||
>numPromise.then(testFunction) : Promise<boolean>
|
||||
>numPromise.then : { <U>(cb: (x: number) => Promise<U>): Promise<U>; <U>(cb: (x: number) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>; }
|
||||
>numPromise : Promise<number>
|
||||
>then : { <U>(cb: (x: number) => Promise<U>): Promise<U>; <U>(cb: (x: number) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>; }
|
||||
|
||||
@@ -32,8 +32,8 @@ var r3 = foo(new Object()); // {}
|
||||
>Object : ObjectConstructor
|
||||
|
||||
var r4 = foo<Date, Date>(1); // error
|
||||
>r4 : any
|
||||
>foo<Date, Date>(1) : any
|
||||
>r4 : Date
|
||||
>foo<Date, Date>(1) : Date
|
||||
>foo : <T, U extends T>(t: T) => U
|
||||
>1 : 1
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ var arg2: { cb: new <T>(x: T, y: T) => string };
|
||||
>y : T
|
||||
|
||||
var r2 = foo(arg2); // error
|
||||
>r2 : any
|
||||
>foo(arg2) : any
|
||||
>r2 : string
|
||||
>foo(arg2) : string
|
||||
>foo : <T, U>(arg: { cb: new (t: T) => U; }) => U
|
||||
>arg2 : { cb: new <T>(x: T, y: T) => string; }
|
||||
|
||||
@@ -46,8 +46,8 @@ var arg3: { cb: new (x: string, y: number) => string };
|
||||
>y : number
|
||||
|
||||
var r3 = foo(arg3); // error
|
||||
>r3 : any
|
||||
>foo(arg3) : any
|
||||
>r3 : string
|
||||
>foo(arg3) : string
|
||||
>foo : <T, U>(arg: { cb: new (t: T) => U; }) => U
|
||||
>arg3 : { cb: new (x: string, y: number) => string; }
|
||||
|
||||
|
||||
@@ -100,8 +100,8 @@ var r7 = foo3(1, <Z>(a: Z) => '', ''); // string
|
||||
>'' : ""
|
||||
|
||||
var r8 = foo3(1, function (a) { return '' }, 1); // error
|
||||
>r8 : any
|
||||
>foo3(1, function (a) { return '' }, 1) : any
|
||||
>r8 : number
|
||||
>foo3(1, function (a) { return '' }, 1) : 1
|
||||
>foo3 : <T, U>(x: T, cb: (a: T) => U, y: U) => U
|
||||
>1 : 1
|
||||
>function (a) { return '' } : (a: number) => string
|
||||
@@ -125,8 +125,8 @@ function other<T, U>(t: T, u: U) {
|
||||
>u : U
|
||||
|
||||
var r10 = foo2(1, (x: T) => ''); // error
|
||||
>r10 : any
|
||||
>foo2(1, (x: T) => '') : any
|
||||
>r10 : string
|
||||
>foo2(1, (x: T) => '') : string
|
||||
>foo2 : <T, U>(x: T, cb: (a: T) => U) => U
|
||||
>1 : 1
|
||||
>(x: T) => '' : (x: T) => string
|
||||
@@ -134,7 +134,7 @@ function other<T, U>(t: T, u: U) {
|
||||
>'' : ""
|
||||
|
||||
var r10 = foo2(1, (x) => ''); // string
|
||||
>r10 : any
|
||||
>r10 : string
|
||||
>foo2(1, (x) => '') : string
|
||||
>foo2 : <T, U>(x: T, cb: (a: T) => U) => U
|
||||
>1 : 1
|
||||
@@ -143,8 +143,8 @@ function other<T, U>(t: T, u: U) {
|
||||
>'' : ""
|
||||
|
||||
var r11 = foo3(1, (x: T) => '', ''); // error
|
||||
>r11 : any
|
||||
>foo3(1, (x: T) => '', '') : any
|
||||
>r11 : string
|
||||
>foo3(1, (x: T) => '', '') : string
|
||||
>foo3 : <T, U>(x: T, cb: (a: T) => U, y: U) => U
|
||||
>1 : 1
|
||||
>(x: T) => '' : (x: T) => string
|
||||
@@ -153,8 +153,8 @@ function other<T, U>(t: T, u: U) {
|
||||
>'' : ""
|
||||
|
||||
var r11b = foo3(1, (x: T) => '', 1); // error
|
||||
>r11b : any
|
||||
>foo3(1, (x: T) => '', 1) : any
|
||||
>r11b : string
|
||||
>foo3(1, (x: T) => '', 1) : string
|
||||
>foo3 : <T, U>(x: T, cb: (a: T) => U, y: U) => U
|
||||
>1 : 1
|
||||
>(x: T) => '' : (x: T) => string
|
||||
@@ -163,8 +163,8 @@ function other<T, U>(t: T, u: U) {
|
||||
>1 : 1
|
||||
|
||||
var r12 = foo3(1, function (a) { return '' }, 1); // error
|
||||
>r12 : any
|
||||
>foo3(1, function (a) { return '' }, 1) : any
|
||||
>r12 : number
|
||||
>foo3(1, function (a) { return '' }, 1) : 1
|
||||
>foo3 : <T, U>(x: T, cb: (a: T) => U, y: U) => U
|
||||
>1 : 1
|
||||
>function (a) { return '' } : (a: number) => string
|
||||
|
||||
@@ -71,8 +71,8 @@ function foo2<T, U>(x: T, cb: new(a: T) => U) {
|
||||
}
|
||||
|
||||
var r4 = foo2(1, i2); // error
|
||||
>r4 : any
|
||||
>foo2(1, i2) : any
|
||||
>r4 : string
|
||||
>foo2(1, i2) : string
|
||||
>foo2 : <T, U>(x: T, cb: new (a: T) => U) => U
|
||||
>1 : 1
|
||||
>i2 : I2<string>
|
||||
@@ -128,8 +128,8 @@ var r7b = foo3(null, a, ''); // any
|
||||
>'' : ""
|
||||
|
||||
var r8 = foo3(1, i2, 1); // error
|
||||
>r8 : any
|
||||
>foo3(1, i2, 1) : any
|
||||
>r8 : string
|
||||
>foo3(1, i2, 1) : string
|
||||
>foo3 : <T, U>(x: T, cb: new (a: T) => U, y: U) => U
|
||||
>1 : 1
|
||||
>i2 : I2<string>
|
||||
|
||||
@@ -31,8 +31,8 @@ var r = foo(arg); // {}
|
||||
|
||||
// more args not allowed
|
||||
var r2 = foo({ cb: <T>(x: T, y: T) => '' }); // error
|
||||
>r2 : any
|
||||
>foo({ cb: <T>(x: T, y: T) => '' }) : any
|
||||
>r2 : unknown
|
||||
>foo({ cb: <T>(x: T, y: T) => '' }) : unknown
|
||||
>foo : <T, U>(arg: { cb: (t: T) => U; }) => U
|
||||
>{ cb: <T>(x: T, y: T) => '' } : { cb: <T>(x: T, y: T) => string; }
|
||||
>cb : <T>(x: T, y: T) => string
|
||||
@@ -42,8 +42,8 @@ var r2 = foo({ cb: <T>(x: T, y: T) => '' }); // error
|
||||
>'' : ""
|
||||
|
||||
var r3 = foo({ cb: (x: string, y: number) => '' }); // error
|
||||
>r3 : any
|
||||
>foo({ cb: (x: string, y: number) => '' }) : any
|
||||
>r3 : string
|
||||
>foo({ cb: (x: string, y: number) => '' }) : string
|
||||
>foo : <T, U>(arg: { cb: (t: T) => U; }) => U
|
||||
>{ cb: (x: string, y: number) => '' } : { cb: (x: string, y: number) => string; }
|
||||
>cb : (x: string, y: number) => string
|
||||
|
||||
@@ -23,7 +23,7 @@ module onlyT {
|
||||
var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => '');
|
||||
>r1 : (x: {}) => {}
|
||||
>x : {}
|
||||
>foo((x: number) => 1, (x: string) => '') : any
|
||||
>foo((x: number) => 1, (x: string) => '') : (x: number) => number
|
||||
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
|
||||
>(x: number) => 1 : (x: number) => number
|
||||
>x : number
|
||||
@@ -82,8 +82,8 @@ module onlyT {
|
||||
>x : T
|
||||
|
||||
var r7 = foo2((a: T) => a, (b: T) => b); // error
|
||||
>r7 : any
|
||||
>foo2((a: T) => a, (b: T) => b) : any
|
||||
>r7 : (x: Date) => Date
|
||||
>foo2((a: T) => a, (b: T) => b) : (x: Date) => Date
|
||||
>foo2 : <T extends Date>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
|
||||
>(a: T) => a : (a: T) => T
|
||||
>a : T
|
||||
@@ -129,8 +129,8 @@ module onlyT {
|
||||
}
|
||||
|
||||
var r7 = foo3(E.A, (x) => E.A, (x) => F.A); // error
|
||||
>r7 : any
|
||||
>foo3(E.A, (x) => E.A, (x) => F.A) : any
|
||||
>r7 : (x: E) => E
|
||||
>foo3(E.A, (x) => E.A, (x) => F.A) : (x: E) => E
|
||||
>foo3 : <T>(x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T
|
||||
>E.A : E
|
||||
>E : typeof E
|
||||
@@ -226,8 +226,8 @@ module TU {
|
||||
>x : T
|
||||
|
||||
var r7 = foo2((a: T) => a, (b: T) => b);
|
||||
>r7 : any
|
||||
>foo2((a: T) => a, (b: T) => b) : any
|
||||
>r7 : (x: Date) => Date
|
||||
>foo2((a: T) => a, (b: T) => b) : (x: Date) => Date
|
||||
>foo2 : <T extends Date, U extends Date>(a: (x: T) => T, b: (x: U) => U) => (x: T) => T
|
||||
>(a: T) => a : (a: T) => T
|
||||
>a : T
|
||||
|
||||
@@ -175,8 +175,8 @@ var x: (a: string) => boolean;
|
||||
>a : string
|
||||
|
||||
var r11 = foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2); // error
|
||||
>r11 : any
|
||||
>foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2) : any
|
||||
>r11 : (x: (a: string) => boolean) => (n: Object) => number
|
||||
>foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2) : (x: (a: string) => boolean) => (n: Object) => number
|
||||
>foo2 : <T, U>(x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U
|
||||
>x : (a: string) => boolean
|
||||
>(a1: (y: string) => string) => (n: Object) => 1 : (a1: (y: string) => string) => (n: Object) => number
|
||||
@@ -191,8 +191,8 @@ var r11 = foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: stri
|
||||
>2 : 2
|
||||
|
||||
var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // error
|
||||
>r12 : any
|
||||
>foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2) : any
|
||||
>r12 : (x: (z: string) => boolean) => (n: Object) => number
|
||||
>foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2) : (x: (z: string) => boolean) => (n: Object) => number
|
||||
>foo2 : <T, U>(x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U
|
||||
>x : (a: string) => boolean
|
||||
>(a1: (y: string) => boolean) => (n: Object) => 1 : (a1: (y: string) => boolean) => (n: Object) => number
|
||||
|
||||
@@ -10,8 +10,8 @@ function foo<T>(x: { bar: T; baz: T }) {
|
||||
}
|
||||
|
||||
var r = foo({ bar: 1, baz: '' }); // error
|
||||
>r : any
|
||||
>foo({ bar: 1, baz: '' }) : any
|
||||
>r : { bar: number; baz: number; }
|
||||
>foo({ bar: 1, baz: '' }) : { bar: number; baz: number; }
|
||||
>foo : <T>(x: { bar: T; baz: T; }) => { bar: T; baz: T; }
|
||||
>{ bar: 1, baz: '' } : { bar: number; baz: string; }
|
||||
>bar : number
|
||||
|
||||
@@ -9,8 +9,8 @@ function foo<T>(n: { x: T; y: T }, m: T) { return m; }
|
||||
|
||||
// these are all errors
|
||||
var x = foo({ x: 3, y: "" }, 4);
|
||||
>x : any
|
||||
>foo({ x: 3, y: "" }, 4) : any
|
||||
>x : number
|
||||
>foo({ x: 3, y: "" }, 4) : number
|
||||
>foo : <T>(n: { x: T; y: T; }, m: T) => T
|
||||
>{ x: 3, y: "" } : { x: number; y: string; }
|
||||
>x : number
|
||||
@@ -20,8 +20,8 @@ var x = foo({ x: 3, y: "" }, 4);
|
||||
>4 : 4
|
||||
|
||||
var x2 = foo<number>({ x: 3, y: "" }, 4);
|
||||
>x2 : any
|
||||
>foo<number>({ x: 3, y: "" }, 4) : any
|
||||
>x2 : number
|
||||
>foo<number>({ x: 3, y: "" }, 4) : number
|
||||
>foo : <T>(n: { x: T; y: T; }, m: T) => T
|
||||
>{ x: 3, y: "" } : { x: number; y: string; }
|
||||
>x : number
|
||||
@@ -31,8 +31,8 @@ var x2 = foo<number>({ x: 3, y: "" }, 4);
|
||||
>4 : 4
|
||||
|
||||
var x3 = foo<string>({ x: 3, y: "" }, 4);
|
||||
>x3 : any
|
||||
>foo<string>({ x: 3, y: "" }, 4) : any
|
||||
>x3 : string
|
||||
>foo<string>({ x: 3, y: "" }, 4) : string
|
||||
>foo : <T>(n: { x: T; y: T; }, m: T) => T
|
||||
>{ x: 3, y: "" } : { x: number; y: string; }
|
||||
>x : number
|
||||
@@ -42,8 +42,8 @@ var x3 = foo<string>({ x: 3, y: "" }, 4);
|
||||
>4 : 4
|
||||
|
||||
var x4 = foo<number>({ x: "", y: 4 }, "");
|
||||
>x4 : any
|
||||
>foo<number>({ x: "", y: 4 }, "") : any
|
||||
>x4 : number
|
||||
>foo<number>({ x: "", y: 4 }, "") : number
|
||||
>foo : <T>(n: { x: T; y: T; }, m: T) => T
|
||||
>{ x: "", y: 4 } : { x: string; y: number; }
|
||||
>x : string
|
||||
@@ -53,8 +53,8 @@ var x4 = foo<number>({ x: "", y: 4 }, "");
|
||||
>"" : ""
|
||||
|
||||
var x5 = foo<string>({ x: "", y: 4 }, "");
|
||||
>x5 : any
|
||||
>foo<string>({ x: "", y: 4 }, "") : any
|
||||
>x5 : string
|
||||
>foo<string>({ x: "", y: 4 }, "") : string
|
||||
>foo : <T>(n: { x: T; y: T; }, m: T) => T
|
||||
>{ x: "", y: 4 } : { x: string; y: number; }
|
||||
>x : string
|
||||
|
||||
@@ -43,8 +43,8 @@ var d1 = new X<D>();
|
||||
>X : typeof X
|
||||
|
||||
var r = foo(c1, d1); // error
|
||||
>r : any
|
||||
>foo(c1, d1) : any
|
||||
>r : C
|
||||
>foo(c1, d1) : C
|
||||
>foo : <T>(t: X<T>, t2: X<T>) => T
|
||||
>c1 : X<C>
|
||||
>d1 : X<D>
|
||||
|
||||
@@ -36,8 +36,8 @@ function f<T extends Base>(a: { x: T; y: T }) {
|
||||
}
|
||||
|
||||
var r1 = f({ x: new Derived(), y: new Derived2() }); // error because neither is supertype of the other
|
||||
>r1 : any
|
||||
>f({ x: new Derived(), y: new Derived2() }) : any
|
||||
>r1 : Derived
|
||||
>f({ x: new Derived(), y: new Derived2() }) : Derived
|
||||
>f : <T extends Base>(a: { x: T; y: T; }) => T
|
||||
>{ x: new Derived(), y: new Derived2() } : { x: Derived; y: Derived2; }
|
||||
>x : Derived
|
||||
|
||||
@@ -43,8 +43,8 @@ var r = foo(c, d);
|
||||
>d : D
|
||||
|
||||
var r2 = foo(d, c); // error because C does not extend D
|
||||
>r2 : any
|
||||
>foo(d, c) : any
|
||||
>r2 : (x: D) => D
|
||||
>foo(d, c) : (x: D) => D
|
||||
>foo : <T, U extends T>(t: T, t2: U) => (x: T) => U
|
||||
>d : D
|
||||
>c : C
|
||||
@@ -114,8 +114,8 @@ function other<T, U extends T>() {
|
||||
>d : D
|
||||
|
||||
var r5 = foo<T, U>(c, d); // error
|
||||
>r5 : any
|
||||
>foo<T, U>(c, d) : any
|
||||
>r5 : (x: T) => U
|
||||
>foo<T, U>(c, d) : (x: T) => U
|
||||
>foo : <T, U extends T>(t: T, t2: U) => (x: T) => U
|
||||
>c : C
|
||||
>d : D
|
||||
|
||||
@@ -36,15 +36,15 @@ var d: D;
|
||||
>d : D
|
||||
|
||||
var r2 = foo(d, c); // the constraints are self-referencing, no downstream error
|
||||
>r2 : any
|
||||
>foo(d, c) : any
|
||||
>r2 : (x: D) => D
|
||||
>foo(d, c) : (x: D) => D
|
||||
>foo : <T, U extends T>(t: T, t2: U) => (x: T) => U
|
||||
>d : D
|
||||
>c : C
|
||||
|
||||
var r9 = foo(() => 1, () => { }); // the constraints are self-referencing, no downstream error
|
||||
>r9 : any
|
||||
>foo(() => 1, () => { }) : any
|
||||
>r9 : (x: () => number) => () => number
|
||||
>foo(() => 1, () => { }) : (x: () => number) => () => number
|
||||
>foo : <T, U extends T>(t: T, t2: U) => (x: T) => U
|
||||
>() => 1 : () => number
|
||||
>1 : 1
|
||||
@@ -54,8 +54,8 @@ function other<T, U extends T>() {
|
||||
>other : <T, U extends T>() => void
|
||||
|
||||
var r5 = foo<T, U>(c, d); // error
|
||||
>r5 : any
|
||||
>foo<T, U>(c, d) : any
|
||||
>r5 : (x: T) => U
|
||||
>foo<T, U>(c, d) : (x: T) => U
|
||||
>foo : <T, U extends T>(t: T, t2: U) => (x: T) => U
|
||||
>c : C
|
||||
>d : D
|
||||
|
||||
Loaded 100 of 274 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user