Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a const type parameter for Object.freeze. #52317

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/lib/es5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,7 @@ interface ObjectConstructor {
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
* @param o Object on which to lock the attributes.
*/
freeze<T extends {[idx: string]: U | null | undefined | object}, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>;

/**
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
* @param o Object on which to lock the attributes.
*/
freeze<T>(o: T): Readonly<T>;
freeze<const T>(o: T): Readonly<T>;

/**
* Prevents the addition of new properties to an object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tests/cases/compiler/weird.js(9,17): error TS7006: Parameter 'error' implicitly
someFunction(function(BaseClass) {
~~~~~~~~~~~~
!!! error TS2552: Cannot find name 'someFunction'. Did you mean 'Function'?
!!! related TS2728 /.ts/lib.es5.d.ts:321:13: 'Function' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:315:13: 'Function' is declared here.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really want to send a PR which changes the baselines to filter out all line numbers from lib.*.d.ts files; it really sucks to modify a baseline and have it all be line numbers that don't matter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking the same - however, maybe start conservative and only do that on related spans.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other problem is that when you add a new overload to a lib, more than just line numbers change; any use gets more symbols too, so it's not a perfect solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~~~~~~~~~
!!! error TS7006: Parameter 'BaseClass' implicitly has an 'any' type.
'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
// Repro from #17711

Object.freeze({
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

foo() {
>foo : Symbol(foo, Decl(circularContextualReturnType.ts, 2, 15))

return Object.freeze('a');
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

},
});
Expand Down
16 changes: 8 additions & 8 deletions tests/baselines/reference/circularContextualReturnType.types
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
// Repro from #17711

Object.freeze({
>Object.freeze({ foo() { return Object.freeze('a'); },}) : Readonly<{ foo(): string; }>
>Object.freeze : { <T extends Function>(f: T): T; <T extends { [idx: string]: object | U | null | undefined; }, U extends string | number | bigint | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
>Object.freeze({ foo() { return Object.freeze('a'); },}) : Readonly<{ readonly foo: () => "a"; }>
>Object.freeze : { <T extends Function>(f: T): T; <const T>(o: T): Readonly<T>; }
>Object : ObjectConstructor
>freeze : { <T extends Function>(f: T): T; <T extends { [idx: string]: object | U | null | undefined; }, U extends string | number | bigint | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
>{ foo() { return Object.freeze('a'); },} : { foo(): string; }
>freeze : { <T extends Function>(f: T): T; <const T>(o: T): Readonly<T>; }
>{ foo() { return Object.freeze('a'); },} : { foo(): "a"; }

foo() {
>foo : () => string
>foo : () => "a"

return Object.freeze('a');
>Object.freeze('a') : string
>Object.freeze : { <T extends Function>(f: T): T; <T extends { [idx: string]: object | U | null | undefined; }, U extends string | number | bigint | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
>Object.freeze('a') : "a"
>Object.freeze : { <T extends Function>(f: T): T; <const T>(o: T): Readonly<T>; }
>Object : ObjectConstructor
>freeze : { <T extends Function>(f: T): T; <T extends { [idx: string]: object | U | null | undefined; }, U extends string | number | bigint | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
>freeze : { <T extends Function>(f: T): T; <const T>(o: T): Readonly<T>; }
>'a' : "a"

},
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/completionsStringMethods.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@
"target": {
"fileName": "lib.d.ts",
"textSpan": {
"start": 18529,
"start": 18196,
"length": 28
}
}
Expand All @@ -1128,7 +1128,7 @@
"target": {
"fileName": "lib.d.ts",
"textSpan": {
"start": 18529,
"start": 18196,
"length": 28
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// #49101

Object.freeze({
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

f: function () { }
>f : Symbol(f, Decl(contextualSignatureInObjectFreeze.ts, 2, 15))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// #49101

Object.freeze({
>Object.freeze({ f: function () { }}) : Readonly<{ f: () => void; }>
>Object.freeze : { <T extends Function>(f: T): T; <T extends { [idx: string]: object | U; }, U extends string | number | bigint | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
>Object.freeze({ f: function () { }}) : Readonly<{ readonly f: () => void; }>
>Object.freeze : { <T extends Function>(f: T): T; <const T>(o: T): Readonly<T>; }
>Object : ObjectConstructor
>freeze : { <T extends Function>(f: T): T; <T extends { [idx: string]: object | U; }, U extends string | number | bigint | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
>freeze : { <T extends Function>(f: T): T; <const T>(o: T): Readonly<T>; }
>{ f: function () { }} : { f: () => void; }

f: function () { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
a1(...array2); // Error parameter type is (number|string)[]
~~~~~~
!!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'?
!!! related TS2728 /.ts/lib.es5.d.ts:1498:13: 'Array' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1492:13: 'Array' is declared here.
a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]]
~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type '[[any]]'.
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/destructuringTuple.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload mat
!!! error TS2769: Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
!!! error TS2769: Type 'never[]' is not assignable to type '[]'.
!!! error TS2769: Target allows only 0 element(s) but source may have more.
!!! related TS6502 /.ts/lib.es5.d.ts:1463:24: The expected type comes from the return type of this signature.
!!! related TS6502 /.ts/lib.es5.d.ts:1469:27: The expected type comes from the return type of this signature.
!!! related TS6502 /.ts/lib.es5.d.ts:1457:24: The expected type comes from the return type of this signature.
!!! related TS6502 /.ts/lib.es5.d.ts:1463:27: The expected type comes from the return type of this signature.
~~
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/duplicateNumericIndexers.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ tests/cases/conformance/types/members/duplicateNumericIndexers.ts(24,5): error T
tests/cases/conformance/types/members/duplicateNumericIndexers.ts(25,5): error TS2374: Duplicate index signature for type 'number'.
tests/cases/conformance/types/members/duplicateNumericIndexers.ts(29,5): error TS2374: Duplicate index signature for type 'number'.
tests/cases/conformance/types/members/duplicateNumericIndexers.ts(30,5): error TS2374: Duplicate index signature for type 'number'.
lib.es5.d.ts(520,5): error TS2374: Duplicate index signature for type 'number'.
lib.es5.d.ts(1484,5): error TS2374: Duplicate index signature for type 'number'.
lib.es5.d.ts(514,5): error TS2374: Duplicate index signature for type 'number'.
lib.es5.d.ts(1478,5): error TS2374: Duplicate index signature for type 'number'.


==== tests/cases/conformance/types/members/duplicateNumericIndexers.ts (12 errors) ====
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/externModule.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,20 @@ tests/cases/compiler/externModule.ts(37,3): error TS2552: Cannot find name 'XDat
var d=new XDate();
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:941:13: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:935:13: 'Date' is declared here.
d.getDay();
d=new XDate(1978,2);
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:941:13: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:935:13: 'Date' is declared here.
d.getXDate();
var n=XDate.parse("3/2/2004");
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:941:13: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:935:13: 'Date' is declared here.
n=XDate.UTC(1964,2,1);
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:941:13: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:935:13: 'Date' is declared here.


2 changes: 1 addition & 1 deletion tests/baselines/reference/invalidTypeOfTarget.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/invalidTypeOfTarget.ts
var x7: typeof function f() { };
~~~~~~~~
!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
!!! related TS2728 /.ts/lib.es5.d.ts:321:13: 'Function' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:315:13: 'Function' is declared here.
~
!!! error TS1005: ',' expected.
~
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/jsEnumTagOnObjectFrozen.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ cbThing(type => {
/** @enum {string} */
const Thing = Object.freeze({
>Thing : Symbol(Thing, Decl(index.js, 1, 5), Decl(index.js, 0, 4))
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

a: "thing",
>a : Symbol(a, Decl(index.js, 1, 29))
Expand Down
20 changes: 10 additions & 10 deletions tests/baselines/reference/jsEnumTagOnObjectFrozen.types
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== tests/cases/compiler/usage.js ===
const { Thing, useThing, cbThing } = require("./index");
>Thing : Readonly<{ a: "thing"; b: "chill"; }>
>Thing : Readonly<{ readonly a: "thing"; readonly b: "chill"; }>
>useThing : (x: string) => void
>cbThing : (x: (x: string) => void) => void
>require("./index") : typeof import("tests/cases/compiler/index")
Expand All @@ -11,7 +11,7 @@ useThing(Thing.a);
>useThing(Thing.a) : void
>useThing : (x: string) => void
>Thing.a : "thing"
>Thing : Readonly<{ a: "thing"; b: "chill"; }>
>Thing : Readonly<{ readonly a: "thing"; readonly b: "chill"; }>
>a : "thing"

/**
Expand Down Expand Up @@ -47,11 +47,11 @@ cbThing(type => {
=== tests/cases/compiler/index.js ===
/** @enum {string} */
const Thing = Object.freeze({
>Thing : Readonly<{ a: "thing"; b: "chill"; }>
>Object.freeze({ a: "thing", b: "chill"}) : Readonly<{ a: "thing"; b: "chill"; }>
>Object.freeze : { <T extends Function>(f: T): T; <T extends { [idx: string]: object | U; }, U extends string | number | bigint | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
>Thing : Readonly<{ readonly a: "thing"; readonly b: "chill"; }>
>Object.freeze({ a: "thing", b: "chill"}) : Readonly<{ readonly a: "thing"; readonly b: "chill"; }>
>Object.freeze : { <T extends Function>(f: T): T; <const T>(o: T): Readonly<T>; }
>Object : ObjectConstructor
>freeze : { <T extends Function>(f: T): T; <T extends { [idx: string]: object | U; }, U extends string | number | bigint | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
>freeze : { <T extends Function>(f: T): T; <const T>(o: T): Readonly<T>; }
>{ a: "thing", b: "chill"} : { a: "thing"; b: "chill"; }

a: "thing",
Expand All @@ -65,11 +65,11 @@ const Thing = Object.freeze({
});

exports.Thing = Thing;
>exports.Thing = Thing : Readonly<{ a: "thing"; b: "chill"; }>
>exports.Thing : Readonly<{ a: "thing"; b: "chill"; }>
>exports.Thing = Thing : Readonly<{ readonly a: "thing"; readonly b: "chill"; }>
>exports.Thing : Readonly<{ readonly a: "thing"; readonly b: "chill"; }>
>exports : typeof import("tests/cases/compiler/index")
>Thing : Readonly<{ a: "thing"; b: "chill"; }>
>Thing : Readonly<{ a: "thing"; b: "chill"; }>
>Thing : Readonly<{ readonly a: "thing"; readonly b: "chill"; }>
>Thing : Readonly<{ readonly a: "thing"; readonly b: "chill"; }>

/**
* @param {Thing} x
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/keyofAndIndexedAccess.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -1933,9 +1933,9 @@ class SampleClass<P> {
>this.props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 536, 22))
>this : Symbol(SampleClass, Decl(keyofAndIndexedAccess.ts, 532, 1))
>props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 536, 22))
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>props : Symbol(props, Decl(keyofAndIndexedAccess.ts, 538, 16))
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/keyofAndIndexedAccess.types
Original file line number Diff line number Diff line change
Expand Up @@ -1876,9 +1876,9 @@ class SampleClass<P> {
>this : this
>props : Readonly<P>
>Object.freeze(props) : Readonly<P>
>Object.freeze : { <T extends Function>(f: T): T; <T extends { [idx: string]: object | U | null | undefined; }, U extends string | number | bigint | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
>Object.freeze : { <T extends Function>(f: T): T; <const T>(o: T): Readonly<T>; }
>Object : ObjectConstructor
>freeze : { <T extends Function>(f: T): T; <T extends { [idx: string]: object | U | null | undefined; }, U extends string | number | bigint | boolean | symbol>(o: T): Readonly<T>; <T>(o: T): Readonly<T>; }
>freeze : { <T extends Function>(f: T): T; <const T>(o: T): Readonly<T>; }
>props : P
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ tests/cases/compiler/mappedTypeWithAsClauseAndLateBoundProperty.ts(3,1): error T
tgt2 = src2; // Should error
~~~~
!!! error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { <S extends number>(predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { <S extends number>(predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { <S extends number>(predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator<number>; values: () => IterableIterator<number>; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: <A, D extends number = 1>(this: A, depth?: D) => FlatArray<A, D>[]; [iterator]: () => IterableIterator<number>; [unscopables]: () => { copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: boolean; values: boolean; }; }' but required in type 'number[]'.
!!! related TS2728 /.ts/lib.es5.d.ts:1307:5: 'length' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1301:5: 'length' is declared here.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tests/cases/conformance/types/any/narrowExceptionVariableInCatchClause.ts(16,17)
err.massage; // ERROR: Property 'massage' does not exist on type 'Error'
~~~~~~~
!!! error TS2551: Property 'massage' does not exist on type 'Error'. Did you mean 'message'?
!!! related TS2728 /.ts/lib.es5.d.ts:1057:5: 'message' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1051:5: 'message' is declared here.
}

else {
Expand Down
Loading