Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Issue #14833 - TypeScripts Type System is Turing Complete

https://github.com/microsoft/TypeScript/issues/14833



Does this mean that some types never get resolved? How does the type checker handle that?


Indeed, the link gives an example of such an infinitely recursive type:

    type Foo<T extends "true", B> = { "true": Foo<T, Foo<T, B>> }[T];
    let f: Foo<"true", {}> = null!;

As for how it's handled, it yields the error "Type instantiation is excessively deep and possibly infinite. [2589]" I'm not sure what the max stack depth is, though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: