From 044822b7f53ed2bae02f4e30a13b7b1daf0f96dd Mon Sep 17 00:00:00 2001 From: Mykola Basov Date: Wed, 22 Jun 2022 09:33:46 +0100 Subject: [PATCH] Add .findLast() and .findLastIndex() (#69) * Add .findLast(), .findLastIndex(), and es2023 target Signed-off-by: mbasov2 * Update baselines Signed-off-by: mbasov2 Remove ES2023 target (#75) Signed-off-by: mbasov2 --- src/compiler/commandLineParser.ts | 4 +- src/lib/es2023.array.d.ts | 324 +++++++++++++++++ src/lib/es2023.d.ts | 2 + src/lib/es2023.full.d.ts | 5 + src/lib/esnext.d.ts | 2 +- src/lib/libs.json | 3 + .../reference/callWithSpread4.symbols | 4 +- .../Parse --lib option with extra comma.js | 2 +- ... --lib option with trailing white-space.js | 2 +- .../Parse invalid option of library flags.js | 2 +- .../dependentDestructuredVariables.symbols | 4 +- tests/baselines/reference/findLast.js | 57 +++ tests/baselines/reference/findLast.symbols | 187 ++++++++++ tests/baselines/reference/findLast.types | 325 ++++++++++++++++++ .../flatArrayNoExcessiveStackDepth.symbols | 2 +- .../importExportInternalComments.symbols | 2 +- .../reference/indexAt(target=esnext).symbols | 22 +- .../reference/keyofAndIndexedAccess2.symbols | 12 +- .../noIterationTypeErrorsInCFA.symbols | 2 +- .../recursiveConditionalTypes.symbols | 4 +- .../taggedTemplatesWithTypeArguments1.symbols | 2 +- ...does-not-add-color-when-NO_COLOR-is-set.js | 2 +- ...-when-host-can't-provide-terminal-width.js | 2 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 2 +- .../typeGuardConstructorNarrowAny.symbols | 2 +- ...typeGuardConstructorPrimitiveTypes.symbols | 2 +- tests/cases/compiler/findLast.ts | 29 ++ 27 files changed, 971 insertions(+), 37 deletions(-) create mode 100644 src/lib/es2023.array.d.ts create mode 100644 src/lib/es2023.d.ts create mode 100644 src/lib/es2023.full.d.ts create mode 100644 tests/baselines/reference/findLast.js create mode 100644 tests/baselines/reference/findLast.symbols create mode 100644 tests/baselines/reference/findLast.types create mode 100644 tests/cases/compiler/findLast.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 4a699c8bc34e6..f4a00631c0b0d 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -156,6 +156,7 @@ const libEntries: [string, string][] = [ ["es2020", "lib.es2020.d.ts"], ["es2021", "lib.es2021.d.ts"], ["es2022", "lib.es2022.d.ts"], + ["es2023", "lib.es2023.d.ts"], ["esnext", "lib.esnext.d.ts"], // Host only ["dom", "lib.dom.d.ts"], @@ -209,7 +210,8 @@ const libEntries: [string, string][] = [ ["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"], ["es2022.string", "lib.es2022.string.d.ts"], ["es2022.regexp", "lib.es2022.regexp.d.ts"], - ["esnext.array", "lib.es2022.array.d.ts"], + ["es2023.array", "lib.es2023.array.d.ts"], + ["esnext.array", "lib.es2023.array.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"], ["esnext.intl", "lib.esnext.intl.d.ts"], diff --git a/src/lib/es2023.array.d.ts b/src/lib/es2023.array.d.ts new file mode 100644 index 0000000000000..ff55a71ee9888 --- /dev/null +++ b/src/lib/es2023.array.d.ts @@ -0,0 +1,324 @@ +interface Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): T | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number; +} + +interface ReadonlyArray { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number; +} + +interface Int8Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; +} + +interface Uint8Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; +} + +interface Uint8ClampedArray { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; +} + +interface Int16Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; +} + +interface Uint16Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; +} + +interface Int32Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; +} + +interface Uint32Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; +} + +interface Float32Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; +} + +interface Float64Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; +} + +interface BigInt64Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: bigint, index: number, obj: readonly bigint[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any): bigint | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any): number; +} + +interface BigUint64Array { + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLast(predicate: (this: void, value: bigint, index: number, obj: readonly bigint[]) => value is S, thisArg?: any): S | undefined; + findLast(predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any): bigint | undefined; + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findLastIndex(predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any): number; +} diff --git a/src/lib/es2023.d.ts b/src/lib/es2023.d.ts new file mode 100644 index 0000000000000..02292dc39546f --- /dev/null +++ b/src/lib/es2023.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/src/lib/es2023.full.d.ts b/src/lib/es2023.full.d.ts new file mode 100644 index 0000000000000..f4246d530ee1f --- /dev/null +++ b/src/lib/es2023.full.d.ts @@ -0,0 +1,5 @@ +/// +/// +/// +/// +/// diff --git a/src/lib/esnext.d.ts b/src/lib/esnext.d.ts index 6735ced8f7367..30eaf070bfb96 100644 --- a/src/lib/esnext.d.ts +++ b/src/lib/esnext.d.ts @@ -1,2 +1,2 @@ -/// +/// /// diff --git a/src/lib/libs.json b/src/lib/libs.json index 3a4410ab133d1..0780efe237d71 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -10,6 +10,7 @@ "es2020", "es2021", "es2022", + "es2023", "esnext", // Host only "dom.generated", @@ -63,6 +64,7 @@ "es2022.sharedmemory", "es2022.string", "es2022.regexp", + "es2023.array", "esnext.intl", // Default libraries "es5.full", @@ -74,6 +76,7 @@ "es2020.full", "es2021.full", "es2022.full", + "es2023.full", "esnext.full" ], "paths": { diff --git a/tests/baselines/reference/callWithSpread4.symbols b/tests/baselines/reference/callWithSpread4.symbols index 428f41b17c340..c247d839923f2 100644 --- a/tests/baselines/reference/callWithSpread4.symbols +++ b/tests/baselines/reference/callWithSpread4.symbols @@ -30,7 +30,7 @@ declare const pli: { (streams: ReadonlyArray): Promise; >streams : Symbol(streams, Decl(callWithSpread4.ts, 5, 5)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 2 more) >R : Symbol(R, Decl(callWithSpread4.ts, 0, 0)) >W : Symbol(W, Decl(callWithSpread4.ts, 0, 22)) >RW : Symbol(RW, Decl(callWithSpread4.ts, 1, 22)) @@ -43,7 +43,7 @@ declare const pli: { >RW : Symbol(RW, Decl(callWithSpread4.ts, 1, 22)) >W : Symbol(W, Decl(callWithSpread4.ts, 0, 22)) >streams : Symbol(streams, Decl(callWithSpread4.ts, 6, 23)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >RW : Symbol(RW, Decl(callWithSpread4.ts, 1, 22)) >W : Symbol(W, Decl(callWithSpread4.ts, 0, 22)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js index 0c1181bd65838..6829ad887310c 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: es7,0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js index d0651b896a98c..6c5918632f8f5 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: es7,0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js index dc2756883180c..8d0b48aca3004 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: 0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'. diff --git a/tests/baselines/reference/dependentDestructuredVariables.symbols b/tests/baselines/reference/dependentDestructuredVariables.symbols index 438466e06bd33..39018c6d70c40 100644 --- a/tests/baselines/reference/dependentDestructuredVariables.symbols +++ b/tests/baselines/reference/dependentDestructuredVariables.symbols @@ -378,7 +378,7 @@ interface B { variant: 'b', value: Array } >T : Symbol(T, Decl(dependentDestructuredVariables.ts, 148, 12)) >variant : Symbol(B.variant, Decl(dependentDestructuredVariables.ts, 148, 16)) >value : Symbol(B.value, Decl(dependentDestructuredVariables.ts, 148, 30)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >T : Symbol(T, Decl(dependentDestructuredVariables.ts, 148, 12)) type AB = A | B; @@ -399,7 +399,7 @@ declare function printValueList(t: Array): void; >printValueList : Symbol(printValueList, Decl(dependentDestructuredVariables.ts, 152, 43)) >T : Symbol(T, Decl(dependentDestructuredVariables.ts, 154, 32)) >t : Symbol(t, Decl(dependentDestructuredVariables.ts, 154, 35)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >T : Symbol(T, Decl(dependentDestructuredVariables.ts, 154, 32)) function unrefined1(ab: AB): void { diff --git a/tests/baselines/reference/findLast.js b/tests/baselines/reference/findLast.js new file mode 100644 index 0000000000000..b9ba7b1324b38 --- /dev/null +++ b/tests/baselines/reference/findLast.js @@ -0,0 +1,57 @@ +//// [findLast.ts] +const itemNumber: number | undefined = [0].findLast((item) => item === 0); +const itemString: string | undefined = ["string"].findLast((item) => item === "string"); +new Int8Array().findLast((item) => item === 0); +new Uint8Array().findLast((item) => item === 0); +new Uint8ClampedArray().findLast((item) => item === 0); +new Int16Array().findLast((item) => item === 0); +new Uint16Array().findLast((item) => item === 0); +new Int32Array().findLast((item) => item === 0); +new Uint32Array().findLast((item) => item === 0); +new Float32Array().findLast((item) => item === 0); +new Float64Array().findLast((item) => item === 0); +new BigInt64Array().findLast((item) => item === BigInt(0)); +new BigUint64Array().findLast((item) => item === BigInt(0)); + +const indexNumber: number = [0].findLastIndex((item) => item === 0); +const indexString: number = ["string"].findLastIndex((item) => item === "string"); +new Int8Array().findLastIndex((item) => item === 0); +new Uint8Array().findLastIndex((item) => item === 0); +new Uint8ClampedArray().findLastIndex((item) => item === 0); +new Int16Array().findLastIndex((item) => item === 0); +new Uint16Array().findLastIndex((item) => item === 0); +new Int32Array().findLastIndex((item) => item === 0); +new Uint32Array().findLastIndex((item) => item === 0); +new Float32Array().findLastIndex((item) => item === 0); +new Float64Array().findLastIndex((item) => item === 0); +new BigInt64Array().findLastIndex((item) => item === BigInt(0)); +new BigUint64Array().findLastIndex((item) => item === BigInt(0)); + + +//// [findLast.js] +const itemNumber = [0].findLast((item) => item === 0); +const itemString = ["string"].findLast((item) => item === "string"); +new Int8Array().findLast((item) => item === 0); +new Uint8Array().findLast((item) => item === 0); +new Uint8ClampedArray().findLast((item) => item === 0); +new Int16Array().findLast((item) => item === 0); +new Uint16Array().findLast((item) => item === 0); +new Int32Array().findLast((item) => item === 0); +new Uint32Array().findLast((item) => item === 0); +new Float32Array().findLast((item) => item === 0); +new Float64Array().findLast((item) => item === 0); +new BigInt64Array().findLast((item) => item === BigInt(0)); +new BigUint64Array().findLast((item) => item === BigInt(0)); +const indexNumber = [0].findLastIndex((item) => item === 0); +const indexString = ["string"].findLastIndex((item) => item === "string"); +new Int8Array().findLastIndex((item) => item === 0); +new Uint8Array().findLastIndex((item) => item === 0); +new Uint8ClampedArray().findLastIndex((item) => item === 0); +new Int16Array().findLastIndex((item) => item === 0); +new Uint16Array().findLastIndex((item) => item === 0); +new Int32Array().findLastIndex((item) => item === 0); +new Uint32Array().findLastIndex((item) => item === 0); +new Float32Array().findLastIndex((item) => item === 0); +new Float64Array().findLastIndex((item) => item === 0); +new BigInt64Array().findLastIndex((item) => item === BigInt(0)); +new BigUint64Array().findLastIndex((item) => item === BigInt(0)); diff --git a/tests/baselines/reference/findLast.symbols b/tests/baselines/reference/findLast.symbols new file mode 100644 index 0000000000000..e4340f479f988 --- /dev/null +++ b/tests/baselines/reference/findLast.symbols @@ -0,0 +1,187 @@ +=== tests/cases/compiler/findLast.ts === +const itemNumber: number | undefined = [0].findLast((item) => item === 0); +>itemNumber : Symbol(itemNumber, Decl(findLast.ts, 0, 5)) +>[0].findLast : Symbol(Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>findLast : Symbol(Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 0, 53)) +>item : Symbol(item, Decl(findLast.ts, 0, 53)) + +const itemString: string | undefined = ["string"].findLast((item) => item === "string"); +>itemString : Symbol(itemString, Decl(findLast.ts, 1, 5)) +>["string"].findLast : Symbol(Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>findLast : Symbol(Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 1, 60)) +>item : Symbol(item, Decl(findLast.ts, 1, 60)) + +new Int8Array().findLast((item) => item === 0); +>new Int8Array().findLast : Symbol(Int8Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLast : Symbol(Int8Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 2, 26)) +>item : Symbol(item, Decl(findLast.ts, 2, 26)) + +new Uint8Array().findLast((item) => item === 0); +>new Uint8Array().findLast : Symbol(Uint8Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLast : Symbol(Uint8Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 3, 27)) +>item : Symbol(item, Decl(findLast.ts, 3, 27)) + +new Uint8ClampedArray().findLast((item) => item === 0); +>new Uint8ClampedArray().findLast : Symbol(Uint8ClampedArray.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLast : Symbol(Uint8ClampedArray.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 4, 34)) +>item : Symbol(item, Decl(findLast.ts, 4, 34)) + +new Int16Array().findLast((item) => item === 0); +>new Int16Array().findLast : Symbol(Int16Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLast : Symbol(Int16Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 5, 27)) +>item : Symbol(item, Decl(findLast.ts, 5, 27)) + +new Uint16Array().findLast((item) => item === 0); +>new Uint16Array().findLast : Symbol(Uint16Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLast : Symbol(Uint16Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 6, 28)) +>item : Symbol(item, Decl(findLast.ts, 6, 28)) + +new Int32Array().findLast((item) => item === 0); +>new Int32Array().findLast : Symbol(Int32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLast : Symbol(Int32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 7, 27)) +>item : Symbol(item, Decl(findLast.ts, 7, 27)) + +new Uint32Array().findLast((item) => item === 0); +>new Uint32Array().findLast : Symbol(Uint32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLast : Symbol(Uint32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 8, 28)) +>item : Symbol(item, Decl(findLast.ts, 8, 28)) + +new Float32Array().findLast((item) => item === 0); +>new Float32Array().findLast : Symbol(Float32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLast : Symbol(Float32Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 9, 29)) +>item : Symbol(item, Decl(findLast.ts, 9, 29)) + +new Float64Array().findLast((item) => item === 0); +>new Float64Array().findLast : Symbol(Float64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLast : Symbol(Float64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 10, 29)) +>item : Symbol(item, Decl(findLast.ts, 10, 29)) + +new BigInt64Array().findLast((item) => item === BigInt(0)); +>new BigInt64Array().findLast : Symbol(BigInt64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>findLast : Symbol(BigInt64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 11, 30)) +>item : Symbol(item, Decl(findLast.ts, 11, 30)) +>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + +new BigUint64Array().findLast((item) => item === BigInt(0)); +>new BigUint64Array().findLast : Symbol(BigUint64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>findLast : Symbol(BigUint64Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 12, 31)) +>item : Symbol(item, Decl(findLast.ts, 12, 31)) +>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + +const indexNumber: number = [0].findLastIndex((item) => item === 0); +>indexNumber : Symbol(indexNumber, Decl(findLast.ts, 14, 5)) +>[0].findLastIndex : Symbol(Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>findLastIndex : Symbol(Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 14, 47)) +>item : Symbol(item, Decl(findLast.ts, 14, 47)) + +const indexString: number = ["string"].findLastIndex((item) => item === "string"); +>indexString : Symbol(indexString, Decl(findLast.ts, 15, 5)) +>["string"].findLastIndex : Symbol(Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>findLastIndex : Symbol(Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 15, 54)) +>item : Symbol(item, Decl(findLast.ts, 15, 54)) + +new Int8Array().findLastIndex((item) => item === 0); +>new Int8Array().findLastIndex : Symbol(Int8Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLastIndex : Symbol(Int8Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 16, 31)) +>item : Symbol(item, Decl(findLast.ts, 16, 31)) + +new Uint8Array().findLastIndex((item) => item === 0); +>new Uint8Array().findLastIndex : Symbol(Uint8Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLastIndex : Symbol(Uint8Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 17, 32)) +>item : Symbol(item, Decl(findLast.ts, 17, 32)) + +new Uint8ClampedArray().findLastIndex((item) => item === 0); +>new Uint8ClampedArray().findLastIndex : Symbol(Uint8ClampedArray.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLastIndex : Symbol(Uint8ClampedArray.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 18, 39)) +>item : Symbol(item, Decl(findLast.ts, 18, 39)) + +new Int16Array().findLastIndex((item) => item === 0); +>new Int16Array().findLastIndex : Symbol(Int16Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLastIndex : Symbol(Int16Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 19, 32)) +>item : Symbol(item, Decl(findLast.ts, 19, 32)) + +new Uint16Array().findLastIndex((item) => item === 0); +>new Uint16Array().findLastIndex : Symbol(Uint16Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLastIndex : Symbol(Uint16Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 20, 33)) +>item : Symbol(item, Decl(findLast.ts, 20, 33)) + +new Int32Array().findLastIndex((item) => item === 0); +>new Int32Array().findLastIndex : Symbol(Int32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLastIndex : Symbol(Int32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 21, 32)) +>item : Symbol(item, Decl(findLast.ts, 21, 32)) + +new Uint32Array().findLastIndex((item) => item === 0); +>new Uint32Array().findLastIndex : Symbol(Uint32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLastIndex : Symbol(Uint32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 22, 33)) +>item : Symbol(item, Decl(findLast.ts, 22, 33)) + +new Float32Array().findLastIndex((item) => item === 0); +>new Float32Array().findLastIndex : Symbol(Float32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLastIndex : Symbol(Float32Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 23, 34)) +>item : Symbol(item, Decl(findLast.ts, 23, 34)) + +new Float64Array().findLastIndex((item) => item === 0); +>new Float64Array().findLastIndex : Symbol(Float64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) +>findLastIndex : Symbol(Float64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 24, 34)) +>item : Symbol(item, Decl(findLast.ts, 24, 34)) + +new BigInt64Array().findLastIndex((item) => item === BigInt(0)); +>new BigInt64Array().findLastIndex : Symbol(BigInt64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>findLastIndex : Symbol(BigInt64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 25, 35)) +>item : Symbol(item, Decl(findLast.ts, 25, 35)) +>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + +new BigUint64Array().findLastIndex((item) => item === BigInt(0)); +>new BigUint64Array().findLastIndex : Symbol(BigUint64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) +>findLastIndex : Symbol(BigUint64Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) +>item : Symbol(item, Decl(findLast.ts, 26, 36)) +>item : Symbol(item, Decl(findLast.ts, 26, 36)) +>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + diff --git a/tests/baselines/reference/findLast.types b/tests/baselines/reference/findLast.types new file mode 100644 index 0000000000000..65ab26ca9ee80 --- /dev/null +++ b/tests/baselines/reference/findLast.types @@ -0,0 +1,325 @@ +=== tests/cases/compiler/findLast.ts === +const itemNumber: number | undefined = [0].findLast((item) => item === 0); +>itemNumber : number +>[0].findLast((item) => item === 0) : number +>[0].findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>[0] : number[] +>0 : 0 +>findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>(item) => item === 0 : (this: void, item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +const itemString: string | undefined = ["string"].findLast((item) => item === "string"); +>itemString : string +>["string"].findLast((item) => item === "string") : string +>["string"].findLast : { (predicate: (this: void, value: string, index: number, obj: readonly string[]) => value is S, thisArg?: any): S; (predicate: (value: string, index: number, obj: readonly string[]) => unknown, thisArg?: any): string; } +>["string"] : string[] +>"string" : "string" +>findLast : { (predicate: (this: void, value: string, index: number, obj: readonly string[]) => value is S, thisArg?: any): S; (predicate: (value: string, index: number, obj: readonly string[]) => unknown, thisArg?: any): string; } +>(item) => item === "string" : (this: void, item: string) => boolean +>item : string +>item === "string" : boolean +>item : string +>"string" : "string" + +new Int8Array().findLast((item) => item === 0); +>new Int8Array().findLast((item) => item === 0) : number +>new Int8Array().findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>new Int8Array() : Int8Array +>Int8Array : Int8ArrayConstructor +>findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>(item) => item === 0 : (this: void, item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Uint8Array().findLast((item) => item === 0); +>new Uint8Array().findLast((item) => item === 0) : number +>new Uint8Array().findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>new Uint8Array() : Uint8Array +>Uint8Array : Uint8ArrayConstructor +>findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>(item) => item === 0 : (this: void, item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Uint8ClampedArray().findLast((item) => item === 0); +>new Uint8ClampedArray().findLast((item) => item === 0) : number +>new Uint8ClampedArray().findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>new Uint8ClampedArray() : Uint8ClampedArray +>Uint8ClampedArray : Uint8ClampedArrayConstructor +>findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>(item) => item === 0 : (this: void, item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Int16Array().findLast((item) => item === 0); +>new Int16Array().findLast((item) => item === 0) : number +>new Int16Array().findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>new Int16Array() : Int16Array +>Int16Array : Int16ArrayConstructor +>findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>(item) => item === 0 : (this: void, item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Uint16Array().findLast((item) => item === 0); +>new Uint16Array().findLast((item) => item === 0) : number +>new Uint16Array().findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>new Uint16Array() : Uint16Array +>Uint16Array : Uint16ArrayConstructor +>findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>(item) => item === 0 : (this: void, item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Int32Array().findLast((item) => item === 0); +>new Int32Array().findLast((item) => item === 0) : number +>new Int32Array().findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>new Int32Array() : Int32Array +>Int32Array : Int32ArrayConstructor +>findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>(item) => item === 0 : (this: void, item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Uint32Array().findLast((item) => item === 0); +>new Uint32Array().findLast((item) => item === 0) : number +>new Uint32Array().findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>new Uint32Array() : Uint32Array +>Uint32Array : Uint32ArrayConstructor +>findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>(item) => item === 0 : (this: void, item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Float32Array().findLast((item) => item === 0); +>new Float32Array().findLast((item) => item === 0) : number +>new Float32Array().findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>new Float32Array() : Float32Array +>Float32Array : Float32ArrayConstructor +>findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>(item) => item === 0 : (this: void, item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Float64Array().findLast((item) => item === 0); +>new Float64Array().findLast((item) => item === 0) : number +>new Float64Array().findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>new Float64Array() : Float64Array +>Float64Array : Float64ArrayConstructor +>findLast : { (predicate: (this: void, value: number, index: number, obj: readonly number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any): number; } +>(item) => item === 0 : (this: void, item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new BigInt64Array().findLast((item) => item === BigInt(0)); +>new BigInt64Array().findLast((item) => item === BigInt(0)) : bigint +>new BigInt64Array().findLast : { (predicate: (this: void, value: bigint, index: number, obj: readonly bigint[]) => value is S, thisArg?: any): S; (predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any): bigint; } +>new BigInt64Array() : BigInt64Array +>BigInt64Array : BigInt64ArrayConstructor +>findLast : { (predicate: (this: void, value: bigint, index: number, obj: readonly bigint[]) => value is S, thisArg?: any): S; (predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any): bigint; } +>(item) => item === BigInt(0) : (this: void, item: bigint) => boolean +>item : bigint +>item === BigInt(0) : boolean +>item : bigint +>BigInt(0) : bigint +>BigInt : BigIntConstructor +>0 : 0 + +new BigUint64Array().findLast((item) => item === BigInt(0)); +>new BigUint64Array().findLast((item) => item === BigInt(0)) : bigint +>new BigUint64Array().findLast : { (predicate: (this: void, value: bigint, index: number, obj: readonly bigint[]) => value is S, thisArg?: any): S; (predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any): bigint; } +>new BigUint64Array() : BigUint64Array +>BigUint64Array : BigUint64ArrayConstructor +>findLast : { (predicate: (this: void, value: bigint, index: number, obj: readonly bigint[]) => value is S, thisArg?: any): S; (predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any): bigint; } +>(item) => item === BigInt(0) : (this: void, item: bigint) => boolean +>item : bigint +>item === BigInt(0) : boolean +>item : bigint +>BigInt(0) : bigint +>BigInt : BigIntConstructor +>0 : 0 + +const indexNumber: number = [0].findLastIndex((item) => item === 0); +>indexNumber : number +>[0].findLastIndex((item) => item === 0) : number +>[0].findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>[0] : number[] +>0 : 0 +>findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>(item) => item === 0 : (item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +const indexString: number = ["string"].findLastIndex((item) => item === "string"); +>indexString : number +>["string"].findLastIndex((item) => item === "string") : number +>["string"].findLastIndex : (predicate: (value: string, index: number, obj: readonly string[]) => unknown, thisArg?: any) => number +>["string"] : string[] +>"string" : "string" +>findLastIndex : (predicate: (value: string, index: number, obj: readonly string[]) => unknown, thisArg?: any) => number +>(item) => item === "string" : (item: string) => boolean +>item : string +>item === "string" : boolean +>item : string +>"string" : "string" + +new Int8Array().findLastIndex((item) => item === 0); +>new Int8Array().findLastIndex((item) => item === 0) : number +>new Int8Array().findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>new Int8Array() : Int8Array +>Int8Array : Int8ArrayConstructor +>findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>(item) => item === 0 : (item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Uint8Array().findLastIndex((item) => item === 0); +>new Uint8Array().findLastIndex((item) => item === 0) : number +>new Uint8Array().findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>new Uint8Array() : Uint8Array +>Uint8Array : Uint8ArrayConstructor +>findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>(item) => item === 0 : (item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Uint8ClampedArray().findLastIndex((item) => item === 0); +>new Uint8ClampedArray().findLastIndex((item) => item === 0) : number +>new Uint8ClampedArray().findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>new Uint8ClampedArray() : Uint8ClampedArray +>Uint8ClampedArray : Uint8ClampedArrayConstructor +>findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>(item) => item === 0 : (item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Int16Array().findLastIndex((item) => item === 0); +>new Int16Array().findLastIndex((item) => item === 0) : number +>new Int16Array().findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>new Int16Array() : Int16Array +>Int16Array : Int16ArrayConstructor +>findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>(item) => item === 0 : (item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Uint16Array().findLastIndex((item) => item === 0); +>new Uint16Array().findLastIndex((item) => item === 0) : number +>new Uint16Array().findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>new Uint16Array() : Uint16Array +>Uint16Array : Uint16ArrayConstructor +>findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>(item) => item === 0 : (item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Int32Array().findLastIndex((item) => item === 0); +>new Int32Array().findLastIndex((item) => item === 0) : number +>new Int32Array().findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>new Int32Array() : Int32Array +>Int32Array : Int32ArrayConstructor +>findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>(item) => item === 0 : (item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Uint32Array().findLastIndex((item) => item === 0); +>new Uint32Array().findLastIndex((item) => item === 0) : number +>new Uint32Array().findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>new Uint32Array() : Uint32Array +>Uint32Array : Uint32ArrayConstructor +>findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>(item) => item === 0 : (item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Float32Array().findLastIndex((item) => item === 0); +>new Float32Array().findLastIndex((item) => item === 0) : number +>new Float32Array().findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>new Float32Array() : Float32Array +>Float32Array : Float32ArrayConstructor +>findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>(item) => item === 0 : (item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new Float64Array().findLastIndex((item) => item === 0); +>new Float64Array().findLastIndex((item) => item === 0) : number +>new Float64Array().findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>new Float64Array() : Float64Array +>Float64Array : Float64ArrayConstructor +>findLastIndex : (predicate: (value: number, index: number, obj: readonly number[]) => unknown, thisArg?: any) => number +>(item) => item === 0 : (item: number) => boolean +>item : number +>item === 0 : boolean +>item : number +>0 : 0 + +new BigInt64Array().findLastIndex((item) => item === BigInt(0)); +>new BigInt64Array().findLastIndex((item) => item === BigInt(0)) : number +>new BigInt64Array().findLastIndex : (predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any) => number +>new BigInt64Array() : BigInt64Array +>BigInt64Array : BigInt64ArrayConstructor +>findLastIndex : (predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any) => number +>(item) => item === BigInt(0) : (item: bigint) => boolean +>item : bigint +>item === BigInt(0) : boolean +>item : bigint +>BigInt(0) : bigint +>BigInt : BigIntConstructor +>0 : 0 + +new BigUint64Array().findLastIndex((item) => item === BigInt(0)); +>new BigUint64Array().findLastIndex((item) => item === BigInt(0)) : number +>new BigUint64Array().findLastIndex : (predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any) => number +>new BigUint64Array() : BigUint64Array +>BigUint64Array : BigUint64ArrayConstructor +>findLastIndex : (predicate: (value: bigint, index: number, obj: readonly bigint[]) => unknown, thisArg?: any) => number +>(item) => item === BigInt(0) : (item: bigint) => boolean +>item : bigint +>item === BigInt(0) : boolean +>item : bigint +>BigInt(0) : bigint +>BigInt : BigIntConstructor +>0 : 0 + diff --git a/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols b/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols index e5052d4cdb3a5..7347311303ba0 100644 --- a/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols +++ b/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols @@ -15,7 +15,7 @@ const bar = foo.flatMap(bar => bar as Foo); interface Foo extends Array {} >Foo : Symbol(Foo, Decl(flatArrayNoExcessiveStackDepth.ts, 3, 43)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) // Repros from comments in #43249 diff --git a/tests/baselines/reference/importExportInternalComments.symbols b/tests/baselines/reference/importExportInternalComments.symbols index e4c5f85d9bd77..0b84572b64635 100644 --- a/tests/baselines/reference/importExportInternalComments.symbols +++ b/tests/baselines/reference/importExportInternalComments.symbols @@ -4,7 +4,7 @@ declare module "foo"; === tests/cases/compiler/default.ts === /*1*/ export /*2*/ default /*3*/ Array /*4*/; ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) === tests/cases/compiler/index.ts === /*1*/ import /*2*/ D /*3*/, /*4*/ { /*5*/ A /*6*/, /*7*/ B /*8*/ as /*9*/ C /*10*/ } /*11*/ from /*12*/ "foo"; diff --git a/tests/baselines/reference/indexAt(target=esnext).symbols b/tests/baselines/reference/indexAt(target=esnext).symbols index 09b7425331f42..3f238cf6467f9 100644 --- a/tests/baselines/reference/indexAt(target=esnext).symbols +++ b/tests/baselines/reference/indexAt(target=esnext).symbols @@ -9,56 +9,56 @@ new Int8Array().at(0); >new Int8Array().at : Symbol(Int8Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) >at : Symbol(Int8Array.at, Decl(lib.es2022.array.d.ts, --, --)) new Uint8Array().at(0); >new Uint8Array().at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) >at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --)) new Uint8ClampedArray().at(0); >new Uint8ClampedArray().at : Symbol(Uint8ClampedArray.at, Decl(lib.es2022.array.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) >at : Symbol(Uint8ClampedArray.at, Decl(lib.es2022.array.d.ts, --, --)) new Int16Array().at(0); >new Int16Array().at : Symbol(Int16Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) >at : Symbol(Int16Array.at, Decl(lib.es2022.array.d.ts, --, --)) new Uint16Array().at(0); >new Uint16Array().at : Symbol(Uint16Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) >at : Symbol(Uint16Array.at, Decl(lib.es2022.array.d.ts, --, --)) new Int32Array().at(0); >new Int32Array().at : Symbol(Int32Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) >at : Symbol(Int32Array.at, Decl(lib.es2022.array.d.ts, --, --)) new Uint32Array().at(0); >new Uint32Array().at : Symbol(Uint32Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) >at : Symbol(Uint32Array.at, Decl(lib.es2022.array.d.ts, --, --)) new Float32Array().at(0); >new Float32Array().at : Symbol(Float32Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) >at : Symbol(Float32Array.at, Decl(lib.es2022.array.d.ts, --, --)) new Float64Array().at(0); >new Float64Array().at : Symbol(Float64Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 2 more) >at : Symbol(Float64Array.at, Decl(lib.es2022.array.d.ts, --, --)) new BigInt64Array().at(0); >new BigInt64Array().at : Symbol(BigInt64Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) +>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) >at : Symbol(BigInt64Array.at, Decl(lib.es2022.array.d.ts, --, --)) new BigUint64Array().at(0); >new BigUint64Array().at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) +>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) >at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --)) diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.symbols b/tests/baselines/reference/keyofAndIndexedAccess2.symbols index b773011935e1a..35c1ea4c8d6fe 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess2.symbols @@ -444,9 +444,9 @@ function fn} | {elements: Array}>(par >fn : Symbol(fn, Decl(keyofAndIndexedAccess2.ts, 115, 69)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 119, 12)) >elements : Symbol(elements, Decl(keyofAndIndexedAccess2.ts, 119, 23)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >elements : Symbol(elements, Decl(keyofAndIndexedAccess2.ts, 119, 51)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 119, 77)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 119, 12)) >cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 119, 86)) @@ -463,7 +463,7 @@ function fn} | {elements: Array}>(par function fn2>(param: T, cb: (element: T[number]) => void) { >fn2 : Symbol(fn2, Decl(keyofAndIndexedAccess2.ts, 121, 1)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 123, 13)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 123, 38)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 123, 13)) >cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 123, 47)) @@ -480,7 +480,7 @@ function fn2>(param: T, cb: (element: T[number]) => void function fn3>(param: T, cb: (element: T[number]) => void) { >fn3 : Symbol(fn3, Decl(keyofAndIndexedAccess2.ts, 125, 1)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 129, 13)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 2 more) >param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 129, 46)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 129, 13)) >cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 129, 55)) @@ -498,12 +498,12 @@ function fn4() { let x: Array[K] = 'abc'; >x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 134, 7)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13)) let y: ReadonlyArray[K] = 'abc'; >y : Symbol(y, Decl(keyofAndIndexedAccess2.ts, 135, 7)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 2 more) >K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13)) } diff --git a/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols b/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols index 60040c3ed17c4..5dafdb84061b2 100644 --- a/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols +++ b/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols @@ -13,7 +13,7 @@ export function doRemove(dds: F | F[]) { if (!Array.isArray(dds)) { >Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --)) >dds : Symbol(dds, Decl(noIterationTypeErrorsInCFA.ts, 3, 25)) diff --git a/tests/baselines/reference/recursiveConditionalTypes.symbols b/tests/baselines/reference/recursiveConditionalTypes.symbols index e9b58df3c28a3..dffbbd124f0c0 100644 --- a/tests/baselines/reference/recursiveConditionalTypes.symbols +++ b/tests/baselines/reference/recursiveConditionalTypes.symbols @@ -566,7 +566,7 @@ let five: Add<2, 3>; type _PrependNextNum> = A['length'] extends infer T >_PrependNextNum : Symbol(_PrependNextNum, Decl(recursiveConditionalTypes.ts, 147, 20)) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 151, 21)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 151, 21)) >T : Symbol(T, Decl(recursiveConditionalTypes.ts, 151, 74)) @@ -584,7 +584,7 @@ type _PrependNextNum> = A['length'] extends infer T type _Enumerate, N extends number> = N extends A['length'] >_Enumerate : Symbol(_Enumerate, Decl(recursiveConditionalTypes.ts, 155, 12)) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 157, 16)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >N : Symbol(N, Decl(recursiveConditionalTypes.ts, 157, 41)) >N : Symbol(N, Decl(recursiveConditionalTypes.ts, 157, 41)) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 157, 16)) diff --git a/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols b/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols index f37166423f17c..10a56db271ee1 100644 --- a/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols +++ b/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols @@ -5,7 +5,7 @@ declare function f(strs: TemplateStringsArray, ...callbacks: Array<(x: T) => >strs : Symbol(strs, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 22)) >TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >callbacks : Symbol(callbacks, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 49)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >x : Symbol(x, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 71)) >T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 19)) diff --git a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js index 43a4af12838d2..46c2fcde362f2 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js @@ -110,7 +110,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, esnext.intl +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2023.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, esnext.intl default: undefined --allowJs diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index 9a8a2135d18e7..68c9416772803 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -110,7 +110,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, esnext.intl +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2023.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, esnext.intl default: undefined --allowJs diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 9a8a2135d18e7..68c9416772803 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -110,7 +110,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, esnext.intl +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2023.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, esnext.intl default: undefined --allowJs diff --git a/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols b/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols index 05566a9104682..833263907a4d9 100644 --- a/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols +++ b/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols @@ -26,7 +26,7 @@ if (var1.constructor === Boolean) { } if (var1.constructor === Array) { >var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) var1; // any[] >var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3)) diff --git a/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols b/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols index 281c056204288..e1faecad5628e 100644 --- a/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols +++ b/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols @@ -34,7 +34,7 @@ if (var1.constructor === Array) { >var1.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3)) >constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) var1; // any[] >var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3)) diff --git a/tests/cases/compiler/findLast.ts b/tests/cases/compiler/findLast.ts new file mode 100644 index 0000000000000..cba155e6c6b6d --- /dev/null +++ b/tests/cases/compiler/findLast.ts @@ -0,0 +1,29 @@ +// @target: esnext + +const itemNumber: number | undefined = [0].findLast((item) => item === 0); +const itemString: string | undefined = ["string"].findLast((item) => item === "string"); +new Int8Array().findLast((item) => item === 0); +new Uint8Array().findLast((item) => item === 0); +new Uint8ClampedArray().findLast((item) => item === 0); +new Int16Array().findLast((item) => item === 0); +new Uint16Array().findLast((item) => item === 0); +new Int32Array().findLast((item) => item === 0); +new Uint32Array().findLast((item) => item === 0); +new Float32Array().findLast((item) => item === 0); +new Float64Array().findLast((item) => item === 0); +new BigInt64Array().findLast((item) => item === BigInt(0)); +new BigUint64Array().findLast((item) => item === BigInt(0)); + +const indexNumber: number = [0].findLastIndex((item) => item === 0); +const indexString: number = ["string"].findLastIndex((item) => item === "string"); +new Int8Array().findLastIndex((item) => item === 0); +new Uint8Array().findLastIndex((item) => item === 0); +new Uint8ClampedArray().findLastIndex((item) => item === 0); +new Int16Array().findLastIndex((item) => item === 0); +new Uint16Array().findLastIndex((item) => item === 0); +new Int32Array().findLastIndex((item) => item === 0); +new Uint32Array().findLastIndex((item) => item === 0); +new Float32Array().findLastIndex((item) => item === 0); +new Float64Array().findLastIndex((item) => item === 0); +new BigInt64Array().findLastIndex((item) => item === BigInt(0)); +new BigUint64Array().findLastIndex((item) => item === BigInt(0));