-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Type Circularitystackoverflows caused by circularities, or unexpected errors where no circularity appears to existstackoverflows caused by circularities, or unexpected errors where no circularity appears to exist
Milestone
Description
type SomeType = number | string | SomeType[];
declare var obj: { key: SomeType; };
declare namespace jasmine {
interface Matchers<T> {
toEqual(expected: Expected<T>): void;
}
type Expected<T> = T | {
[K in keyof T]: ExpectedRecursive<T[K]>;
}
type ExpectedRecursive<T> = T | {
[K in keyof T]: ExpectedRecursive<T[K]>;
};
}
declare function expect<T>(actual: T): jasmine.Matchers<T>;
expect(obj).toEqual({ key: 'value1' });With tsc or in the editor
> tsc -p src
src/index.ts:19:21 - error TS2589: Type instantiation is excessively deep and possibly infinite.
expect(obj).toEqual({key: 'value1'});
~~~~~~~~~~~~~~~
Or in the playground for me:
simpleWorker.ts:125 Uncaught (in promise) RangeError: Maximum call stack size exceeded
at isTypeAssignableTo (tsWorker.js:60285)
at isApplicableIndexType (tsWorker.js:56207)
at findApplicableIndexInfo (tsWorker.js:56187)
at getApplicableIndexInfo (tsWorker.js:56236)
at getPropertyTypeForIndexType (tsWorker.js:58675)
at getIndexedAccessTypeOrUndefined (tsWorker.js:59018)
at getIndexedAccessType (tsWorker.js:58940)
at instantiateTypeWorker (tsWorker.js:60141)
at instantiateTypeWithAlias (tsWorker.js:60092)
at instantiateType (tsWorker.js:60075)
This seems to have been caused by the newly introduced recursive definition of
the IDBValidKey, and this causes an infinite type instantiation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Type Circularitystackoverflows caused by circularities, or unexpected errors where no circularity appears to existstackoverflows caused by circularities, or unexpected errors where no circularity appears to exist