3 ms·
> ts/js is were ts is just js with types. You can comment out the types and it just runs. Is this true in the general case? I thought there were typescript fea
by EE84M3i 2y ago
> ts/js is were ts is just js with types. You can comment out the types and it just runs.
Is this true in the general case? I thought there were typescript features that didn't have direct JavaScript alternatives, for example enums.
- paulddraper 2y agoEnums and namespaces are the only runtime features of TypeScript. So, yes, you can't just strip types, but it's close.
- EE84M3i 2y agoIs there a comprehensive list of such incompatibilities documented somewhere?
- judofyr 2y agohttps://www.typescriptlang.org/tsconfig/#isolatedModules https://www.typescriptlang.org/tsconfig/#isolatedModules
- paulddraper 2y agoThat's not the same. That guarantees that the types do not determine the output (e.g. no const enums), not that you can "strip" types to get the same output.
- paulddraper 2y agoNot that I'm aware of. Decorators would be another example. (Though they have always been marked experimental.) And of course JSX, but that's not a TypeScript invention.