π Search Terms
"Maximum call stack size exceeded", "mapped types"
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.4.2#code/C4TwDgpgBAYg9nAPANQHxQLxQN4CgoFQDaA0lAJYB2UA1hCHAGZTIC6AXLAiqa6gNy4AvrlyhIUAEIBDAE4p0WPIWJkqtekxYcWvKBAAewCJQAmAZyhwARgCsIAY2BQA-FLk8SfKJ3PBZVADmgiK4jACulE7kcNTGfgoAFABu0gA24RCc8EhoAJQ4+FAOseZwaRAAdGlwgSnpmXkhoiWUflDWcpwy8tKUIIo4QoJiEH6JnbJNuEA
π» Code
type Foo<V> = {
[K in keyof V]: Foo<V[K]>;
}
type Bar<V> = {
[K in keyof V]: V[K] extends object ? Bar<V[K]> : string;
}
function test<V>(value: Foo<V>) {
console.log(value);
}
const bar: Bar<any> = {};
test(bar);
π Actual behavior
Throws an exception
Uncaught (in promise) RangeError: Maximum call stack size exceeded
π Expected behavior
Either passes type check or reports a problem
Additional information about the issue
No response
π Search Terms
"Maximum call stack size exceeded", "mapped types"
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.4.2#code/C4TwDgpgBAYg9nAPANQHxQLxQN4CgoFQDaA0lAJYB2UA1hCHAGZTIC6AXLAiqa6gNy4AvrlyhIUAEIBDAE4p0WPIWJkqtekxYcWvKBAAewCJQAmAZyhwARgCsIAY2BQA-FLk8SfKJ3PBZVADmgiK4jACulE7kcNTGfgoAFABu0gA24RCc8EhoAJQ4+FAOseZwaRAAdGlwgSnpmXkhoiWUflDWcpwy8tKUIIo4QoJiEH6JnbJNuEA
π» Code
π Actual behavior
Throws an exception
π Expected behavior
Either passes type check or reports a problem
Additional information about the issue
No response