Microsoft/TypeScript
GitHub で見る4.7 regression: Array.flat(infinity) leads to "Type instantiation is excessively deep and possibly infinite." error
Open
#49,280 opened on 2022年5月27日
BugCursed?Domain: check: Type CircularityHelp Wanted
Repository metrics
- Stars
- (48,455 stars)
- PR merge metrics
- (平均マージ 6d 17h) (30d で 9 merged PRs)
説明
Bug Report
🔎 Search Terms
- Array.flat
- Type instantiation is excessively deep and possibly infinite.
- Nested arrays
🕗 Version & Regression Information
- This changed between versions 4.6 and 4.7
⏯ Playground Link
TypeScript Workbench with relevant code
💻 Code
interface Config {
prop?: string;
}
interface ExtendedConfig extends Config {}
type NestedConfigs = Array<ExtendedConfig | NestedConfigs>;
const configs: NestedConfigs[] = [];
const flattened = configs.flat(Infinity);
🙁 Actual behavior
TypeScript raises the following error for the configs.flat(Infinity) call:
Type instantiation is excessively deep and possibly infinite. ts(2589)
🙂 Expected behavior
No error should be raised.