Microsoft/TypeScript
4.7 regression: Array.flat(infinity) leads to "Type instantiation is excessively deep and possibly infinite." error
Aperta
#49.280 aperta il 27 mag 2022
BugCursed?Domain: check: Type CircularityHelp Wanted
Metriche repository
- Star
- (108.860 stelle)
- Metriche merge PR
- (Metriche PR in attesa)
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.