Re:TypeScripts Type System Is Turing Complete
by krastanov on Tuesday August 01, 2017 @08:06PM
(#14906680)
A naive question: Is it only the type inference that will recurse indefinitely? I.e. If you always specify your types and cast them explicitly, is the Turing completeness still an issue?
[ Parent
| on HN ]
Re:TypeScripts Type System Is Turing Complete
by klodolph on Tuesday August 01, 2017 @09:57PM
(#14907276)
Type inference is not necessary in general nor does it look like the TypeScript example here uses type inference in any significant way.
Re:TypeScripts Type System Is Turing Complete
by Gehinnn on Wednesday August 02, 2017 @05:05AM
(#14909034)
The properties that enable TS' type system to be turing complete are recursive types and indexer types.
Indexer types allow you to write `{ foo: string }["foo"]` which results in the type `string`.