forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
target: "es2022"
(microsoft#46291)
* Add `target: "es2022"` * Add Object.hasOwn * formatToParts is es2018 * ref update * optional parameter * Revert "optional parameter" This reverts commit e67d6e5. * undefined * error cause * Lint fix Co-authored-by: Orta <git@orta.io>
- Loading branch information
Showing
57 changed files
with
973 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
interface Array<T> { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): T | undefined; | ||
} | ||
|
||
interface ReadonlyArray<T> { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): T | undefined; | ||
} | ||
|
||
interface Int8Array { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} | ||
|
||
interface Uint8Array { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} | ||
|
||
interface Uint8ClampedArray { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} | ||
|
||
interface Int16Array { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} | ||
|
||
interface Uint16Array { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} | ||
|
||
interface Int32Array { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} | ||
|
||
interface Uint32Array { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} | ||
|
||
interface Float32Array { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} | ||
|
||
interface Float64Array { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} | ||
|
||
interface BigInt64Array { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} | ||
|
||
interface BigUint64Array { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): number | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference lib="es2021" /> | ||
/// <reference lib="es2022.array" /> | ||
/// <reference lib="es2022.error" /> | ||
/// <reference lib="es2022.object" /> | ||
/// <reference lib="es2022.string" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
interface ErrorOptions { | ||
cause?: Error; | ||
} | ||
|
||
interface ErrorConstructor { | ||
new(message?: string, options?: ErrorOptions): Error; | ||
(message?: string, options?: ErrorOptions): Error; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference lib="es2022" /> | ||
/// <reference lib="dom" /> | ||
/// <reference lib="webworker.importscripts" /> | ||
/// <reference lib="scripthost" /> | ||
/// <reference lib="dom.iterable" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
interface Object { | ||
/** | ||
* Determines whether an object has a property with the specified name. | ||
* @param o An object. | ||
* @param v A property name. | ||
*/ | ||
hasOwn(o: object, v: PropertyKey): boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
interface String { | ||
/** | ||
* Returns a new String consisting of the single UTF-16 code unit located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
*/ | ||
at(index: number): string | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
/// <reference lib="es2021" /> | ||
/// <reference lib="es2022" /> | ||
/// <reference lib="esnext.intl" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/callChainWithSuper(target=es2022).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//// [callChainWithSuper.ts] | ||
// GH#34952 | ||
class Base { method?() {} } | ||
class Derived extends Base { | ||
method1() { return super.method?.(); } | ||
method2() { return super["method"]?.(); } | ||
} | ||
|
||
//// [callChainWithSuper.js] | ||
"use strict"; | ||
// GH#34952 | ||
class Base { | ||
method() { } | ||
} | ||
class Derived extends Base { | ||
method1() { return super.method?.(); } | ||
method2() { return super["method"]?.(); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
tests/baselines/reference/errorCause(target=es2021).errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
tests/cases/compiler/errorCause.ts(1,18): error TS2554: Expected 0-1 arguments, but got 2. | ||
|
||
|
||
==== tests/cases/compiler/errorCause.ts (1 errors) ==== | ||
new Error("foo", { cause: new Error("bar") }); | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2554: Expected 0-1 arguments, but got 2. | ||
|
Oops, something went wrong.