Skip to content

Commit 4c6e802

Browse files
committed
Remove bigint from Object.freeze in es5.d.ts
`BigInt` isn't resolved whenever `lib < es2020`, but it's not an error when `target < es2020`. I have a few ideas for improving this situation but for the RC I'm going to remove `bigint` from Object.freeze's signature.
1 parent 0414dee commit 4c6e802

5 files changed

+50
-1
lines changed

src/lib/es5.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ interface ObjectConstructor {
210210
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
211211
* @param o Object on which to lock the attributes.
212212
*/
213-
freeze<T extends {[idx: string]: U | null | undefined | object}, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>;
213+
freeze<T extends {[idx: string]: U | null | undefined | object}, U extends string | number | boolean | symbol>(o: T): Readonly<T>;
214214

215215
/**
216216
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//// [contextualSignatureInObjectFreeze.ts]
2+
// #49101
3+
4+
Object.freeze({
5+
f: function () { }
6+
})
7+
8+
9+
//// [contextualSignatureInObjectFreeze.js]
10+
// #49101
11+
Object.freeze({
12+
f: function () { }
13+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
=== tests/cases/compiler/contextualSignatureInObjectFreeze.ts ===
2+
// #49101
3+
4+
Object.freeze({
5+
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
6+
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
7+
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
8+
9+
f: function () { }
10+
>f : Symbol(f, Decl(contextualSignatureInObjectFreeze.ts, 2, 15))
11+
12+
})
13+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/compiler/contextualSignatureInObjectFreeze.ts ===
2+
// #49101
3+
4+
Object.freeze({
5+
>Object.freeze({ f: function () { }}) : Readonly<{ f: () => void; }>
6+
>Object.freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T extends { [idx: string]: object | U; }, U extends string | number | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
7+
>Object : ObjectConstructor
8+
>freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T extends { [idx: string]: object | U; }, U extends string | number | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
9+
>{ f: function () { }} : { f: () => void; }
10+
11+
f: function () { }
12+
>f : () => void
13+
>function () { } : () => void
14+
15+
})
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// #49101
2+
// @target: es2020
3+
// @lib: es2019
4+
5+
Object.freeze({
6+
f: function () { }
7+
})

0 commit comments

Comments
 (0)