forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
12 changed files
with
282 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//// [arrayFlat.ts] | ||
// #24579 and #29604 | ||
|
||
let [actual] = [[""], [1]].flat(); | ||
const expected: string | number = actual; | ||
actual = undefined as string | number; | ||
const f: any extends typeof actual ? true : false = false; | ||
|
||
|
||
//// [arrayFlat.js] | ||
// #24579 and #29604 | ||
var actual = [[""], [1]].flat()[0]; | ||
var expected = actual; | ||
actual = undefined; | ||
var f = false; |
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,20 @@ | ||
=== tests/cases/compiler/arrayFlat.ts === | ||
// #24579 and #29604 | ||
|
||
let [actual] = [[""], [1]].flat(); | ||
>actual : Symbol(actual, Decl(arrayFlat.ts, 2, 5)) | ||
>[[""], [1]].flat : Symbol(Array.flat, Decl(lib.es2019.array.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) | ||
>flat : Symbol(Array.flat, Decl(lib.es2019.array.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) | ||
|
||
const expected: string | number = actual; | ||
>expected : Symbol(expected, Decl(arrayFlat.ts, 3, 5)) | ||
>actual : Symbol(actual, Decl(arrayFlat.ts, 2, 5)) | ||
|
||
actual = undefined as string | number; | ||
>actual : Symbol(actual, Decl(arrayFlat.ts, 2, 5)) | ||
>undefined : Symbol(undefined) | ||
|
||
const f: any extends typeof actual ? true : false = false; | ||
>f : Symbol(f, Decl(arrayFlat.ts, 5, 5)) | ||
>actual : Symbol(actual, Decl(arrayFlat.ts, 2, 5)) | ||
|
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,31 @@ | ||
=== tests/cases/compiler/arrayFlat.ts === | ||
// #24579 and #29604 | ||
|
||
let [actual] = [[""], [1]].flat(); | ||
>actual : string | number | ||
>[[""], [1]].flat() : (string | number)[] | ||
>[[""], [1]].flat : { (depth: 4): (string | number)[]; (depth: 3): (string | number)[]; (depth: 2): (string | number)[]; (depth?: 1): (string | number)[]; (depth: 0): (string[] | number[])[]; (depth: number): (string[] | number[])[] | (string | number)[]; } | ||
>[[""], [1]] : (string[] | number[])[] | ||
>[""] : string[] | ||
>"" : "" | ||
>[1] : number[] | ||
>1 : 1 | ||
>flat : { (depth: 4): (string | number)[]; (depth: 3): (string | number)[]; (depth: 2): (string | number)[]; (depth?: 1): (string | number)[]; (depth: 0): (string[] | number[])[]; (depth: number): (string[] | number[])[] | (string | number)[]; } | ||
|
||
const expected: string | number = actual; | ||
>expected : string | number | ||
>actual : string | number | ||
|
||
actual = undefined as string | number; | ||
>actual = undefined as string | number : string | number | ||
>actual : string | number | ||
>undefined as string | number : string | number | ||
>undefined : undefined | ||
|
||
const f: any extends typeof actual ? true : false = false; | ||
>f : boolean | ||
>actual : string | number | ||
>true : true | ||
>false : false | ||
>false : false | ||
|
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
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,8 @@ | ||
// @lib: es2019 | ||
|
||
// #24579 and #29604 | ||
|
||
let [actual] = [[""], [1]].flat(); | ||
const expected: string | number = actual; | ||
actual = undefined as string | number; | ||
const f: any extends typeof actual ? true : false = false; |
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