Skip to content

Commit 63a65d7

Browse files
committed
Add Object.hasOwn
1 parent 5b7da72 commit 63a65d7

13 files changed

+89
-77
lines changed

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ namespace ts {
7474
["es2021.weakref", "lib.es2021.weakref.d.ts"],
7575
["es2021.intl", "lib.es2021.intl.d.ts"],
7676
["es2022.array", "lib.es2022.array.d.ts"],
77+
["es2022.object", "lib.es2022.object.d.ts"],
7778
["es2022.string", "lib.es2022.string.d.ts"],
7879
["esnext.array", "lib.es2022.array.d.ts"],
7980
["esnext.symbol", "lib.es2019.symbol.d.ts"],

src/compiler/utilities.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ namespace ts {
641641
Float64Array: ["at"],
642642
BigInt64Array: ["at"],
643643
BigUint64Array: ["at"],
644+
ObjectConstructor: ["hasOwn"],
644645
},
645646
esnext: {
646647
NumberFormat: ["formatToParts"]

src/lib/es2022.array.d.ts

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,103 @@
11
interface Array<T> {
2-
/**
3-
* Returns the item located at the specified index.
4-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
5-
*/
6-
at(index: number): T;
2+
/**
3+
* Returns the item located at the specified index.
4+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
5+
*/
6+
at(index: number): T;
77
}
88

99
interface ReadonlyArray<T> {
10-
/**
11-
* Returns the item located at the specified index.
12-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
13-
*/
14-
at(index: number): T;
10+
/**
11+
* Returns the item located at the specified index.
12+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
13+
*/
14+
at(index: number): T;
1515
}
1616

1717
interface Int8Array {
18-
/**
19-
* Returns the item located at the specified index.
20-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
21-
*/
22-
at(index: number): number;
18+
/**
19+
* Returns the item located at the specified index.
20+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
21+
*/
22+
at(index: number): number;
2323
}
2424

2525
interface Uint8Array {
26-
/**
27-
* Returns the item located at the specified index.
28-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
29-
*/
30-
at(index: number): number;
26+
/**
27+
* Returns the item located at the specified index.
28+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
29+
*/
30+
at(index: number): number;
3131
}
3232

3333
interface Uint8ClampedArray {
34-
/**
35-
* Returns the item located at the specified index.
36-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
37-
*/
38-
at(index: number): number;
34+
/**
35+
* Returns the item located at the specified index.
36+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
37+
*/
38+
at(index: number): number;
3939
}
4040

4141
interface Int16Array {
42-
/**
43-
* Returns the item located at the specified index.
44-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
45-
*/
46-
at(index: number): number;
42+
/**
43+
* Returns the item located at the specified index.
44+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
45+
*/
46+
at(index: number): number;
4747
}
4848

4949
interface Uint16Array {
50-
/**
51-
* Returns the item located at the specified index.
52-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
53-
*/
54-
at(index: number): number;
50+
/**
51+
* Returns the item located at the specified index.
52+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
53+
*/
54+
at(index: number): number;
5555
}
5656

5757
interface Int32Array {
58-
/**
59-
* Returns the item located at the specified index.
60-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
61-
*/
62-
at(index: number): number;
58+
/**
59+
* Returns the item located at the specified index.
60+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
61+
*/
62+
at(index: number): number;
6363
}
6464

6565
interface Uint32Array {
66-
/**
67-
* Returns the item located at the specified index.
68-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
69-
*/
70-
at(index: number): number;
66+
/**
67+
* Returns the item located at the specified index.
68+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
69+
*/
70+
at(index: number): number;
7171
}
7272

7373
interface Float32Array {
74-
/**
75-
* Returns the item located at the specified index.
76-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
77-
*/
78-
at(index: number): number;
74+
/**
75+
* Returns the item located at the specified index.
76+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
77+
*/
78+
at(index: number): number;
7979
}
8080

8181
interface Float64Array {
82-
/**
83-
* Returns the item located at the specified index.
84-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
85-
*/
86-
at(index: number): number;
82+
/**
83+
* Returns the item located at the specified index.
84+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
85+
*/
86+
at(index: number): number;
8787
}
8888

8989
interface BigInt64Array {
90-
/**
91-
* Returns the item located at the specified index.
92-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
93-
*/
94-
at(index: number): number;
90+
/**
91+
* Returns the item located at the specified index.
92+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
93+
*/
94+
at(index: number): number;
9595
}
9696

9797
interface BigUint64Array {
98-
/**
99-
* Returns the item located at the specified index.
100-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
101-
*/
102-
at(index: number): number;
98+
/**
99+
* Returns the item located at the specified index.
100+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
101+
*/
102+
at(index: number): number;
103103
}

src/lib/es2022.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/// <reference lib="es2021" />
22
/// <reference lib="es2022.array" />
3+
/// <reference lib="es2022.object" />
34
/// <reference lib="es2022.string" />

src/lib/es2022.object.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
interface Object {
2+
/**
3+
* Determines whether an object has a property with the specified name.
4+
* @param o An object.
5+
* @param v A property name.
6+
*/
7+
hasOwn(o: object, v: PropertyKey): boolean;
8+
}

src/lib/es2022.string.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interface String {
2-
/**
3-
* Returns a new String consisting of the single UTF-16 code unit located at the specified index.
4-
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
5-
*/
6-
at(index: number): string;
2+
/**
3+
* Returns a new String consisting of the single UTF-16 code unit located at the specified index.
4+
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
5+
*/
6+
at(index: number): string;
77
}

src/lib/libs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"es2021.weakref",
5555
"es2021.intl",
5656
"es2022.array",
57+
"es2022.object",
5758
"es2022.string",
5859
"esnext.intl",
5960
// Default libraries

tests/baselines/reference/esNextWeakRefs_IterableWeakMap.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ export class IterableWeakMap<K extends object, V> implements WeakMap<K, V> {
297297

298298
Object.defineProperties(IterableWeakMap.prototype, {
299299
>Object.defineProperties : Symbol(ObjectConstructor.defineProperties, Decl(lib.es5.d.ts, --, --))
300-
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
300+
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --))
301301
>defineProperties : Symbol(ObjectConstructor.defineProperties, Decl(lib.es5.d.ts, --, --))
302302
>IterableWeakMap.prototype : Symbol(IterableWeakMap.prototype)
303303
>IterableWeakMap : Symbol(IterableWeakMap, Decl(esNextWeakRefs_IterableWeakMap.ts, 6, 2))
@@ -322,7 +322,7 @@ Object.defineProperties(IterableWeakMap.prototype, {
322322
>value : Symbol(value, Decl(esNextWeakRefs_IterableWeakMap.ts, 89, 23))
323323
>Object.getOwnPropertyDescriptor( IterableWeakMap.prototype, "entries", )!.value : Symbol(PropertyDescriptor.value, Decl(lib.es5.d.ts, --, --))
324324
>Object.getOwnPropertyDescriptor : Symbol(ObjectConstructor.getOwnPropertyDescriptor, Decl(lib.es5.d.ts, --, --))
325-
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
325+
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --))
326326
>getOwnPropertyDescriptor : Symbol(ObjectConstructor.getOwnPropertyDescriptor, Decl(lib.es5.d.ts, --, --))
327327

328328
IterableWeakMap.prototype,

tests/baselines/reference/inferenceOptionalPropertiesToIndexSignatures.symbols

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const query = Object.entries(obj).map(
7272
>Object.entries(obj).map( ([k, v]) => `${k}=${encodeURIComponent(v)}`).join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --))
7373
>Object.entries(obj).map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
7474
>Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --))
75-
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
75+
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --))
7676
>entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --))
7777
>obj : Symbol(obj, Decl(inferenceOptionalPropertiesToIndexSignatures.ts, 16, 5))
7878
>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))

tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n
7777

7878
--lib
7979
Specify a set of bundled library declaration files that describe the target runtime environment.
80-
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, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref
80+
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, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref
8181

8282
--allowJs
8383
Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.

tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n
7777

7878
--lib
7979
Specify a set of bundled library declaration files that describe the target runtime environment.
80-
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, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref
80+
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, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref
8181

8282
--allowJs
8383
Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.

tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n
7777

7878
--lib
7979
Specify a set of bundled library declaration files that describe the target runtime environment.
80-
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, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref
80+
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, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref
8181

8282
--allowJs
8383
Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.

tests/baselines/reference/unionTypeInference.symbols

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ async function fun<T>(deepPromised: DeepPromised<T>) {
230230
for (const value of Object.values(deepPromisedWithIndexer)) {
231231
>value : Symbol(value, Decl(unionTypeInference.ts, 62, 14))
232232
>Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --))
233-
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
233+
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --))
234234
>values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --))
235235
>deepPromisedWithIndexer : Symbol(deepPromisedWithIndexer, Decl(unionTypeInference.ts, 61, 9))
236236

0 commit comments

Comments
 (0)