-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e12250
commit b429811
Showing
61 changed files
with
1,286 additions
and
530 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/baselines/reference/arrayFilterBooleanOverload#56013WithoutExternalOverload.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//// [tests/cases/compiler/arrayFilterBooleanOverload#56013WithoutExternalOverload.ts] //// | ||
|
||
//// [arrayFilterBooleanOverload#56013WithoutExternalOverload.ts] | ||
type NonFalsy<T> = T extends false | 0 | "" | null | undefined | 0n | ||
? never | ||
: T; | ||
|
||
const id = <T,>() => (t: T) => !!t; | ||
|
||
['foo', 'bar'].filter(id()); // // expect id() = (t: string) => boolean | ||
|
||
['foo', 'bar', 1].filter(id()); // // expect id() = (t: string | number) => boolean | ||
|
||
declare const maybe: boolean; | ||
(maybe ? ['foo', 'bar'] : [1] ).filter(id()); // expect id() = (t: string | number) => boolean | ||
|
||
['foo', 'bar', undefined].filter(id()); // expect id() = (t: string | undefined) => boolean | ||
|
||
|
||
//// [arrayFilterBooleanOverload#56013WithoutExternalOverload.js] | ||
"use strict"; | ||
const id = () => (t) => !!t; | ||
['foo', 'bar'].filter(id()); // // expect id() = (t: string) => boolean | ||
['foo', 'bar', 1].filter(id()); // // expect id() = (t: string | number) => boolean | ||
(maybe ? ['foo', 'bar'] : [1]).filter(id()); // expect id() = (t: string | number) => boolean | ||
['foo', 'bar', undefined].filter(id()); // expect id() = (t: string | undefined) => boolean | ||
|
||
|
||
//// [arrayFilterBooleanOverload#56013WithoutExternalOverload.d.ts] | ||
type NonFalsy<T> = T extends false | 0 | "" | null | undefined | 0n ? never : T; | ||
declare const id: <T>() => (t: T) => boolean; | ||
declare const maybe: boolean; |
44 changes: 44 additions & 0 deletions
44
tests/baselines/reference/arrayFilterBooleanOverload#56013WithoutExternalOverload.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//// [tests/cases/compiler/arrayFilterBooleanOverload#56013WithoutExternalOverload.ts] //// | ||
|
||
=== arrayFilterBooleanOverload#56013WithoutExternalOverload.ts === | ||
type NonFalsy<T> = T extends false | 0 | "" | null | undefined | 0n | ||
>NonFalsy : Symbol(NonFalsy, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 0, 0)) | ||
>T : Symbol(T, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 0, 14)) | ||
>T : Symbol(T, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 0, 14)) | ||
|
||
? never | ||
: T; | ||
>T : Symbol(T, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 0, 14)) | ||
|
||
const id = <T,>() => (t: T) => !!t; | ||
>id : Symbol(id, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 5)) | ||
>T : Symbol(T, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 12)) | ||
>t : Symbol(t, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 22)) | ||
>T : Symbol(T, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 12)) | ||
>t : Symbol(t, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 22)) | ||
|
||
['foo', 'bar'].filter(id()); // // expect id() = (t: string) => boolean | ||
>['foo', 'bar'].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, --, --)) | ||
>id : Symbol(id, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 5)) | ||
|
||
['foo', 'bar', 1].filter(id()); // // expect id() = (t: string | number) => boolean | ||
>['foo', 'bar', 1].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, --, --)) | ||
>id : Symbol(id, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 5)) | ||
|
||
declare const maybe: boolean; | ||
>maybe : Symbol(maybe, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 10, 13)) | ||
|
||
(maybe ? ['foo', 'bar'] : [1] ).filter(id()); // expect id() = (t: string | number) => boolean | ||
>(maybe ? ['foo', 'bar'] : [1] ).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, --, --) ... and 1 more) | ||
>maybe : Symbol(maybe, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 10, 13)) | ||
>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, --, --) ... and 1 more) | ||
>id : Symbol(id, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 5)) | ||
|
||
['foo', 'bar', undefined].filter(id()); // expect id() = (t: string | undefined) => boolean | ||
>['foo', 'bar', undefined].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>undefined : Symbol(undefined) | ||
>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>id : Symbol(id, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 5)) | ||
|
Oops, something went wrong.