Microsoft/TypeScript
Vedi su GitHub4.7 regression: Array.flat(infinity) leads to "Type instantiation is excessively deep and possibly infinite." error
Open
#49.280 aperta il 27 mag 2022
BugCursed?Domain: check: Type CircularityHelp Wanted
Metriche repository
- Star
- (48.455 star)
- Metriche merge PR
- (Merge medio 6g 17h) (9 PR mergiate in 30 g)
Descrizione
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.