From 3beef9d47b6addba1028be92cb7b542151443709 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 14 Sep 2016 17:43:45 +0200 Subject: [PATCH 1/4] add Array.prototype.filter signature with type guard --- src/lib/es5.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 90f3a31a77c3c..15e594f95fa35 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1206,6 +1206,12 @@ interface Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; /** * Returns the elements of an array that meet the condition specified in a callback function. * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. From 26e214267ef08bd1bf0dbd079edad0ab8ba3f838 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 14 Sep 2016 20:59:21 +0200 Subject: [PATCH 2/4] run `gulp baseline-accept` --- tests/baselines/reference/arrayFilter.symbols | 4 ++-- tests/baselines/reference/declarationEmitPromise.symbols | 8 ++++---- tests/baselines/reference/declarationEmitPromise.types | 8 ++++---- .../reference/genericMethodOverspecialization.symbols | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/baselines/reference/arrayFilter.symbols b/tests/baselines/reference/arrayFilter.symbols index fcdd39117a73e..cba8f48c89f1d 100644 --- a/tests/baselines/reference/arrayFilter.symbols +++ b/tests/baselines/reference/arrayFilter.symbols @@ -14,9 +14,9 @@ var foo = [ ] foo.filter(x => x.name); //should accepted all possible types not only boolean! ->foo.filter : Symbol(Array.filter, Decl(lib.d.ts, --, --)) +>foo.filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >foo : Symbol(foo, Decl(arrayFilter.ts, 0, 3)) ->filter : Symbol(Array.filter, Decl(lib.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(arrayFilter.ts, 6, 11)) >x.name : Symbol(name, Decl(arrayFilter.ts, 1, 5)) >x : Symbol(x, Decl(arrayFilter.ts, 6, 11)) diff --git a/tests/baselines/reference/declarationEmitPromise.symbols b/tests/baselines/reference/declarationEmitPromise.symbols index 2c37e1dfa78ff..115833352dac0 100644 --- a/tests/baselines/reference/declarationEmitPromise.symbols +++ b/tests/baselines/reference/declarationEmitPromise.symbols @@ -40,13 +40,13 @@ export async function runSampleWorks( >bluebird.all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26)) >bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) >all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26)) ->[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --)) +>[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(declarationEmitPromise.ts, 5, 52)) >b : Symbol(b, Decl(declarationEmitPromise.ts, 6, 19)) >c : Symbol(c, Decl(declarationEmitPromise.ts, 6, 36)) >d : Symbol(d, Decl(declarationEmitPromise.ts, 6, 53)) >e : Symbol(e, Decl(declarationEmitPromise.ts, 6, 70)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 7, 68)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 7, 68)) @@ -112,13 +112,13 @@ export async function runSampleBreaks( >bluebird.all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26)) >bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) >all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 1, 26)) ->[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --)) +>[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(declarationEmitPromise.ts, 14, 53)) >b : Symbol(b, Decl(declarationEmitPromise.ts, 15, 19)) >c : Symbol(c, Decl(declarationEmitPromise.ts, 15, 36)) >d : Symbol(d, Decl(declarationEmitPromise.ts, 15, 53)) >e : Symbol(e, Decl(declarationEmitPromise.ts, 15, 70)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 16, 68)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 16, 68)) diff --git a/tests/baselines/reference/declarationEmitPromise.types b/tests/baselines/reference/declarationEmitPromise.types index 4edaa44432674..b2f92b753c7e7 100644 --- a/tests/baselines/reference/declarationEmitPromise.types +++ b/tests/baselines/reference/declarationEmitPromise.types @@ -45,14 +45,14 @@ export async function runSampleWorks( >bluebird : typeof bluebird >all : bluebird[] >[a, b, c, d, e].filter(el => !!el) : bluebird[] ->[a, b, c, d, e].filter : (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any) => bluebird[] +>[a, b, c, d, e].filter : { >(callbackfn: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any): bluebird[]; } >[a, b, c, d, e] : bluebird[] >a : bluebird >b : bluebird >c : bluebird >d : bluebird >e : bluebird ->filter : (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any) => bluebird[] +>filter : { >(callbackfn: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any): bluebird[]; } >el => !!el : (el: bluebird) => boolean >el : bluebird >!!el : boolean @@ -130,14 +130,14 @@ export async function runSampleBreaks( >bluebird : typeof bluebird >all : bluebird[] >[a, b, c, d, e].filter(el => !!el) : bluebird[] ->[a, b, c, d, e].filter : (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any) => bluebird[] +>[a, b, c, d, e].filter : { >(callbackfn: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any): bluebird[]; } >[a, b, c, d, e] : bluebird[] >a : bluebird >b : bluebird >c : bluebird >d : bluebird >e : bluebird ->filter : (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any) => bluebird[] +>filter : { >(callbackfn: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: bluebird, index: number, array: bluebird[]) => any, thisArg?: any): bluebird[]; } >el => !!el : (el: bluebird) => boolean >el : bluebird >!!el : boolean diff --git a/tests/baselines/reference/genericMethodOverspecialization.symbols b/tests/baselines/reference/genericMethodOverspecialization.symbols index 329ca2de67561..9cf7bb995b15f 100644 --- a/tests/baselines/reference/genericMethodOverspecialization.symbols +++ b/tests/baselines/reference/genericMethodOverspecialization.symbols @@ -43,9 +43,9 @@ var elements = names.map(function (name) { var xxx = elements.filter(function (e) { >xxx : Symbol(xxx, Decl(genericMethodOverspecialization.ts, 17, 3)) ->elements.filter : Symbol(Array.filter, Decl(lib.d.ts, --, --)) +>elements.filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >elements : Symbol(elements, Decl(genericMethodOverspecialization.ts, 12, 3)) ->filter : Symbol(Array.filter, Decl(lib.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >e : Symbol(e, Decl(genericMethodOverspecialization.ts, 17, 36)) return !e.isDisabled; From 97ca66b45078013b053f57616b2031f415c07fea Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 14 Sep 2016 21:15:20 +0200 Subject: [PATCH 3/4] run `gulp baseline-accept` a second time --- tests/baselines/reference/arrayFilter.types | 4 ++-- .../baselines/reference/genericMethodOverspecialization.types | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/baselines/reference/arrayFilter.types b/tests/baselines/reference/arrayFilter.types index 43ef4161a0654..7d91ef4ed322b 100644 --- a/tests/baselines/reference/arrayFilter.types +++ b/tests/baselines/reference/arrayFilter.types @@ -22,9 +22,9 @@ var foo = [ foo.filter(x => x.name); //should accepted all possible types not only boolean! >foo.filter(x => x.name) : { name: string; }[] ->foo.filter : (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg?: any) => { name: string; }[] +>foo.filter : { (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg?: any): { name: string; }[]; } >foo : { name: string; }[] ->filter : (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg?: any) => { name: string; }[] +>filter : { (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg?: any): { name: string; }[]; } >x => x.name : (x: { name: string; }) => string >x : { name: string; } >x.name : string diff --git a/tests/baselines/reference/genericMethodOverspecialization.types b/tests/baselines/reference/genericMethodOverspecialization.types index 268943a97231e..40286124f5169 100644 --- a/tests/baselines/reference/genericMethodOverspecialization.types +++ b/tests/baselines/reference/genericMethodOverspecialization.types @@ -53,9 +53,9 @@ var elements = names.map(function (name) { var xxx = elements.filter(function (e) { >xxx : HTMLElement[] >elements.filter(function (e) { return !e.isDisabled;}) : HTMLElement[] ->elements.filter : (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg?: any) => HTMLElement[] +>elements.filter : { (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg?: any): HTMLElement[]; } >elements : HTMLElement[] ->filter : (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg?: any) => HTMLElement[] +>filter : { (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg?: any): HTMLElement[]; } >function (e) { return !e.isDisabled;} : (e: HTMLElement) => boolean >e : HTMLElement From a8111692d8426c6fa76dd57b8369be17b124adb5 Mon Sep 17 00:00:00 2001 From: Michael Maier Date: Thu, 4 May 2017 09:00:00 +0200 Subject: [PATCH 4/4] update array filter signatures with type guard --- src/lib/es5.d.ts | 4 +++- tests/baselines/reference/arrayFilter.symbols | 4 ++-- tests/baselines/reference/arrayFilter.types | 4 ++-- tests/baselines/reference/declarationEmitPromise.symbols | 8 ++++---- tests/baselines/reference/declarationEmitPromise.types | 8 ++++---- .../reference/genericMethodOverspecialization.symbols | 4 ++-- .../reference/genericMethodOverspecialization.types | 4 ++-- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index ff155d06e68b3..639d053a9ac3c 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1240,7 +1240,9 @@ interface Array { * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; + filter(callbackfn: (this: void, value: T, index: number, array: T[]) => value is S): S[]; + filter(callbackfn: (this: void, value: T, index: number, array: T[]) => value is S, thisArg: undefined): S[]; + filter(callbackfn: (this: Z, value: T, index: number, array: T[]) => value is S, thisArg: Z): S[]; /** * Returns the elements of an array that meet the condition specified in a callback function. * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. diff --git a/tests/baselines/reference/arrayFilter.symbols b/tests/baselines/reference/arrayFilter.symbols index 81d92ba04b6a2..d750acc919528 100644 --- a/tests/baselines/reference/arrayFilter.symbols +++ b/tests/baselines/reference/arrayFilter.symbols @@ -14,9 +14,9 @@ var foo = [ ] foo.filter(x => x.name); //should accepted all possible types not only boolean! ->foo.filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>foo.filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >foo : Symbol(foo, Decl(arrayFilter.ts, 0, 3)) ->filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(arrayFilter.ts, 6, 11)) >x.name : Symbol(name, Decl(arrayFilter.ts, 1, 5)) >x : Symbol(x, Decl(arrayFilter.ts, 6, 11)) diff --git a/tests/baselines/reference/arrayFilter.types b/tests/baselines/reference/arrayFilter.types index 23ab4d915bd22..24200c7a52f31 100644 --- a/tests/baselines/reference/arrayFilter.types +++ b/tests/baselines/reference/arrayFilter.types @@ -22,9 +22,9 @@ var foo = [ foo.filter(x => x.name); //should accepted all possible types not only boolean! >foo.filter(x => x.name) : { name: string; }[] ->foo.filter : { (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => any): { name: string; }[]; (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: undefined): { name: string; }[]; (callbackfn: (this: Z, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: Z): { name: string; }[]; } +>foo.filter : { (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => value is S): S[]; (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg: undefined): S[]; (callbackfn: (this: Z, value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg: Z): S[]; (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => any): { name: string; }[]; (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: undefined): { name: string; }[]; (callbackfn: (this: Z, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: Z): { name: string; }[]; } >foo : { name: string; }[] ->filter : { (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => any): { name: string; }[]; (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: undefined): { name: string; }[]; (callbackfn: (this: Z, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: Z): { name: string; }[]; } +>filter : { (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => value is S): S[]; (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg: undefined): S[]; (callbackfn: (this: Z, value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg: Z): S[]; (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => any): { name: string; }[]; (callbackfn: (this: void, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: undefined): { name: string; }[]; (callbackfn: (this: Z, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: Z): { name: string; }[]; } >x => x.name : (this: void, x: { name: string; }) => string >x : { name: string; } >x.name : string diff --git a/tests/baselines/reference/declarationEmitPromise.symbols b/tests/baselines/reference/declarationEmitPromise.symbols index d1333bb060c78..475dc96d15ccf 100644 --- a/tests/baselines/reference/declarationEmitPromise.symbols +++ b/tests/baselines/reference/declarationEmitPromise.symbols @@ -39,13 +39,13 @@ export async function runSampleWorks( >bluebird.all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 0, 26)) >bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) >all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 0, 26)) ->[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(declarationEmitPromise.ts, 4, 52)) >b : Symbol(b, Decl(declarationEmitPromise.ts, 5, 19)) >c : Symbol(c, Decl(declarationEmitPromise.ts, 5, 36)) >d : Symbol(d, Decl(declarationEmitPromise.ts, 5, 53)) >e : Symbol(e, Decl(declarationEmitPromise.ts, 5, 70)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 6, 68)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 6, 68)) @@ -111,13 +111,13 @@ export async function runSampleBreaks( >bluebird.all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 0, 26)) >bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) >all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 0, 26)) ->[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(declarationEmitPromise.ts, 13, 53)) >b : Symbol(b, Decl(declarationEmitPromise.ts, 14, 19)) >c : Symbol(c, Decl(declarationEmitPromise.ts, 14, 36)) >d : Symbol(d, Decl(declarationEmitPromise.ts, 14, 53)) >e : Symbol(e, Decl(declarationEmitPromise.ts, 14, 70)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 15, 68)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 15, 68)) diff --git a/tests/baselines/reference/declarationEmitPromise.types b/tests/baselines/reference/declarationEmitPromise.types index 9fafbd0cbd6f8..e7cdb62f34e58 100644 --- a/tests/baselines/reference/declarationEmitPromise.types +++ b/tests/baselines/reference/declarationEmitPromise.types @@ -44,14 +44,14 @@ export async function runSampleWorks( >bluebird : typeof bluebird >all : bluebird[] >[a, b, c, d, e].filter(el => !!el) : bluebird[] ->[a, b, c, d, e].filter : { (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any): bluebird[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any, thisArg: undefined): bluebird[]; (callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => any, thisArg: Z): bluebird[]; } +>[a, b, c, d, e].filter : { >(callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => value is S): S[]; >(callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => value is S, thisArg: undefined): S[]; , Z>(callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => value is S, thisArg: Z): S[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any): bluebird[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any, thisArg: undefined): bluebird[]; (callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => any, thisArg: Z): bluebird[]; } >[a, b, c, d, e] : bluebird[] >a : bluebird >b : bluebird >c : bluebird >d : bluebird >e : bluebird ->filter : { (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any): bluebird[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any, thisArg: undefined): bluebird[]; (callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => any, thisArg: Z): bluebird[]; } +>filter : { >(callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => value is S): S[]; >(callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => value is S, thisArg: undefined): S[]; , Z>(callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => value is S, thisArg: Z): S[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any): bluebird[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any, thisArg: undefined): bluebird[]; (callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => any, thisArg: Z): bluebird[]; } >el => !!el : (this: void, el: bluebird) => boolean >el : bluebird >!!el : boolean @@ -129,14 +129,14 @@ export async function runSampleBreaks( >bluebird : typeof bluebird >all : bluebird[] >[a, b, c, d, e].filter(el => !!el) : bluebird[] ->[a, b, c, d, e].filter : { (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any): bluebird[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any, thisArg: undefined): bluebird[]; (callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => any, thisArg: Z): bluebird[]; } +>[a, b, c, d, e].filter : { >(callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => value is S): S[]; >(callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => value is S, thisArg: undefined): S[]; , Z>(callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => value is S, thisArg: Z): S[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any): bluebird[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any, thisArg: undefined): bluebird[]; (callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => any, thisArg: Z): bluebird[]; } >[a, b, c, d, e] : bluebird[] >a : bluebird >b : bluebird >c : bluebird >d : bluebird >e : bluebird ->filter : { (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any): bluebird[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any, thisArg: undefined): bluebird[]; (callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => any, thisArg: Z): bluebird[]; } +>filter : { >(callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => value is S): S[]; >(callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => value is S, thisArg: undefined): S[]; , Z>(callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => value is S, thisArg: Z): S[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any): bluebird[]; (callbackfn: (this: void, value: bluebird, index: number, array: bluebird[]) => any, thisArg: undefined): bluebird[]; (callbackfn: (this: Z, value: bluebird, index: number, array: bluebird[]) => any, thisArg: Z): bluebird[]; } >el => !!el : (this: void, el: bluebird) => boolean >el : bluebird >!!el : boolean diff --git a/tests/baselines/reference/genericMethodOverspecialization.symbols b/tests/baselines/reference/genericMethodOverspecialization.symbols index 55ff9cb5afbc6..e1c14103514d2 100644 --- a/tests/baselines/reference/genericMethodOverspecialization.symbols +++ b/tests/baselines/reference/genericMethodOverspecialization.symbols @@ -43,9 +43,9 @@ var elements = names.map(function (name) { var xxx = elements.filter(function (e) { >xxx : Symbol(xxx, Decl(genericMethodOverspecialization.ts, 17, 3)) ->elements.filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>elements.filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >elements : Symbol(elements, Decl(genericMethodOverspecialization.ts, 12, 3)) ->filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >e : Symbol(e, Decl(genericMethodOverspecialization.ts, 17, 36)) return !e.isDisabled; diff --git a/tests/baselines/reference/genericMethodOverspecialization.types b/tests/baselines/reference/genericMethodOverspecialization.types index 17f3e0dddd76c..b969211213ac6 100644 --- a/tests/baselines/reference/genericMethodOverspecialization.types +++ b/tests/baselines/reference/genericMethodOverspecialization.types @@ -53,9 +53,9 @@ var elements = names.map(function (name) { var xxx = elements.filter(function (e) { >xxx : HTMLElement[] >elements.filter(function (e) { return !e.isDisabled;}) : HTMLElement[] ->elements.filter : { (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => any): HTMLElement[]; (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg: undefined): HTMLElement[]; (callbackfn: (this: Z, value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg: Z): HTMLElement[]; } +>elements.filter : { (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => value is S): S[]; (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg: undefined): S[]; (callbackfn: (this: Z, value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg: Z): S[]; (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => any): HTMLElement[]; (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg: undefined): HTMLElement[]; (callbackfn: (this: Z, value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg: Z): HTMLElement[]; } >elements : HTMLElement[] ->filter : { (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => any): HTMLElement[]; (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg: undefined): HTMLElement[]; (callbackfn: (this: Z, value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg: Z): HTMLElement[]; } +>filter : { (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => value is S): S[]; (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg: undefined): S[]; (callbackfn: (this: Z, value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg: Z): S[]; (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => any): HTMLElement[]; (callbackfn: (this: void, value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg: undefined): HTMLElement[]; (callbackfn: (this: Z, value: HTMLElement, index: number, array: HTMLElement[]) => any, thisArg: Z): HTMLElement[]; } >function (e) { return !e.isDisabled;} : (this: void, e: HTMLElement) => boolean >e : HTMLElement