-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 Pick PR #58951 (Add non-mutating Array methods to e...) into releas…
…e-5.5 (#59405) Co-authored-by: Daniel Rosenwasser <[email protected]>
- Loading branch information
1 parent
c8a7d58
commit 5270c59
Showing
8 changed files
with
801 additions
and
0 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
64 changes: 64 additions & 0 deletions
64
tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2023(target=es5).errors.txt
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,64 @@ | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(7,31): error TS2550: Property 'findLastIndex' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(7,45): error TS7006: Parameter 'v' implicitly has an 'any' type. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(8,31): error TS2550: Property 'findLastIndex' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(10,26): error TS2550: Property 'findLast' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(11,26): error TS2550: Property 'findLast' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(13,27): error TS2550: Property 'toSorted' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(15,29): error TS2550: Property 'toSpliced' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(16,29): error TS2550: Property 'toSpliced' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(17,29): error TS2550: Property 'toSpliced' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(18,29): error TS2550: Property 'toSpliced' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(19,29): error TS2550: Property 'toSpliced' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(21,34): error TS2550: Property 'with' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
doYouNeedToChangeYourTargetLibraryES2023.ts(22,29): error TS2550: Property 'with' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
|
||
|
||
==== doYouNeedToChangeYourTargetLibraryES2023.ts (13 errors) ==== | ||
export let array = [0, 2, 3, 4]; | ||
|
||
function somePredicate(x: any): boolean { | ||
return x === 4; | ||
} | ||
|
||
export let lastIndex1 = array.findLastIndex(v => v === 4); | ||
~~~~~~~~~~~~~ | ||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
~ | ||
!!! error TS7006: Parameter 'v' implicitly has an 'any' type. | ||
export let lastIndex2 = array.findLastIndex(somePredicate); | ||
~~~~~~~~~~~~~ | ||
!!! error TS2550: Property 'findLastIndex' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
|
||
export let last1 = array.findLast(somePredicate); | ||
~~~~~~~~ | ||
!!! error TS2550: Property 'findLast' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
export let last2 = array.findLast(somePredicate); | ||
~~~~~~~~ | ||
!!! error TS2550: Property 'findLast' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
|
||
export let sorted = array.toSorted(); | ||
~~~~~~~~ | ||
!!! error TS2550: Property 'toSorted' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
|
||
export let spliced1 = array.toSpliced(2); | ||
~~~~~~~~~ | ||
!!! error TS2550: Property 'toSpliced' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
export let spliced2 = array.toSpliced(2, 1); | ||
~~~~~~~~~ | ||
!!! error TS2550: Property 'toSpliced' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
export let spliced3 = array.toSpliced(2, 1, 4, 5, 6, 7); | ||
~~~~~~~~~ | ||
!!! error TS2550: Property 'toSpliced' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
export let spliced4 = array.toSpliced(2, undefined); | ||
~~~~~~~~~ | ||
!!! error TS2550: Property 'toSpliced' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
export let spliced5 = array.toSpliced(2, undefined, 4, 5, 6, 7); | ||
~~~~~~~~~ | ||
!!! error TS2550: Property 'toSpliced' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
|
||
export let startsWithOne = array.with(0, 1); | ||
~~~~ | ||
!!! error TS2550: Property 'with' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. | ||
export let inTheEnd = array.with(-1, 1); | ||
~~~~ | ||
!!! error TS2550: Property 'with' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later. |
69 changes: 69 additions & 0 deletions
69
tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2023(target=es5).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,69 @@ | ||
//// [tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2023.ts] //// | ||
|
||
=== doYouNeedToChangeYourTargetLibraryES2023.ts === | ||
export let array = [0, 2, 3, 4]; | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
|
||
function somePredicate(x: any): boolean { | ||
>somePredicate : Symbol(somePredicate, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 32)) | ||
>x : Symbol(x, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 2, 23)) | ||
|
||
return x === 4; | ||
>x : Symbol(x, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 2, 23)) | ||
} | ||
|
||
export let lastIndex1 = array.findLastIndex(v => v === 4); | ||
>lastIndex1 : Symbol(lastIndex1, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 6, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
>v : Symbol(v, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 6, 44)) | ||
>v : Symbol(v, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 6, 44)) | ||
|
||
export let lastIndex2 = array.findLastIndex(somePredicate); | ||
>lastIndex2 : Symbol(lastIndex2, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 7, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
>somePredicate : Symbol(somePredicate, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 32)) | ||
|
||
export let last1 = array.findLast(somePredicate); | ||
>last1 : Symbol(last1, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 9, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
>somePredicate : Symbol(somePredicate, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 32)) | ||
|
||
export let last2 = array.findLast(somePredicate); | ||
>last2 : Symbol(last2, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 10, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
>somePredicate : Symbol(somePredicate, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 32)) | ||
|
||
export let sorted = array.toSorted(); | ||
>sorted : Symbol(sorted, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 12, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
|
||
export let spliced1 = array.toSpliced(2); | ||
>spliced1 : Symbol(spliced1, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 14, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
|
||
export let spliced2 = array.toSpliced(2, 1); | ||
>spliced2 : Symbol(spliced2, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 15, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
|
||
export let spliced3 = array.toSpliced(2, 1, 4, 5, 6, 7); | ||
>spliced3 : Symbol(spliced3, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 16, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
|
||
export let spliced4 = array.toSpliced(2, undefined); | ||
>spliced4 : Symbol(spliced4, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 17, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
>undefined : Symbol(undefined) | ||
|
||
export let spliced5 = array.toSpliced(2, undefined, 4, 5, 6, 7); | ||
>spliced5 : Symbol(spliced5, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 18, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
>undefined : Symbol(undefined) | ||
|
||
export let startsWithOne = array.with(0, 1); | ||
>startsWithOne : Symbol(startsWithOne, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 20, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
|
||
export let inTheEnd = array.with(-1, 1); | ||
>inTheEnd : Symbol(inTheEnd, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 21, 10)) | ||
>array : Symbol(array, Decl(doYouNeedToChangeYourTargetLibraryES2023.ts, 0, 10)) | ||
|
Oops, something went wrong.