Open
Description
Bug Report
This is the simplest repro of an issue that prevents the use of recursive mapped types for any type that contain any properties (or properties of properties etc...) typed using a recursive type alias.
🔎 Search Terms
- Type Alias
- Mapped Types
- Recursive Types
- Type instantiation is excessively deep and possibly infinite
🕗 Version & Regression Information
Since 3.7
⏯ Playground Link
💻 Code
type RecursiveType = string | number | RecursiveType[];
type MappedType<T> = {
[K in keyof T]: MappedType<T[K]>;
};
type MappedTypeOfRecursiveType = MappedType<RecursiveType>;
🙁 Actual behavior
Type instantiation is excessively deep and possibly infinite. (2589)
🙂 Expected behavior
Expected to compile successfully