You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exporttypeDirectoryBase={name: string}exporttypeDirectoryEntries={readonly[ninstring]: Directory};exporttypeDirectory=DirectoryBase&{entries: DirectoryEntries};exporttypeExactDirectory<EextendsDirectoryEntries>=DirectoryBase&{entries: E};exporttypeAccessor<DextendsDirectory>=DextendsDirectory ? {[KinkeyofD['entries']]: Accessor<D['entries'][K]>} : {};// intersection and conditional type are necessary to exhibit the problemexporttypeBadAccessor<DextendsDirectory>={}&(DextendsDirectory ? {[KinkeyofD['entries']]: Accessor<D['entries'][K]>} : {});functionf<EextendsDirectoryEntries,CextendsDirectory>(accessor: Accessor<C>): void{consta1=accessorasAccessor<ExactDirectory<E>>;// ok, error as expectedconsta2=accessorasBadAccessor<ExactDirectory<E>>;// boom}
Expected behavior:
compilation error is reported
Actual behavior:
apparently, compilation does not terminate
Playground Link: nope WARNING pasting the above code to the playground freezes the playground UI, and because it remembers the code you are stuck forever. Browsers start warning about unresponsive page after a while.
Related Issues:
might be the same as #27066 but observed behavior is different
The text was updated successfully, but these errors were encountered:
I'm assuming "contrived" here means this what at least somewhat constructed instead of being "found" in real code - let me know if that's not the case. With Turing completeness sometimes comes nontermination 🤷♂️
It was constructed in the process of writing code, and that code was supposed to become real. "Contrived" in this context means "expressing some constraints which would be useful to enforce in client code".
The thing is, some usages of such a type are typechecked just fine, and I found only one case so far where it's problematic, and I can bypass this one easily because it happened in the implementation code where I could just use type assertion as any, so it's not that important.
TypeScript Version: 3.1.0-dev.20180913
Search Terms:
typechecking infinite recursion
Code
Expected behavior:
compilation error is reported
Actual behavior:
apparently, compilation does not terminate
Playground Link: nope WARNING pasting the above code to the playground freezes the playground UI, and because it remembers the code you are stuck forever. Browsers start warning about unresponsive page after a while.
Related Issues:
might be the same as #27066 but observed behavior is different
The text was updated successfully, but these errors were encountered: