r/webdev • u/maxverse • Jan 18 '22
Resource TypeScript Features to Avoid
https://www.executeprogram.com/blog/typescript-features-to-avoid6
u/ProfaneWords Jan 19 '22 edited Jan 19 '22
It sounds like the author should just stick to JS with JSDoc annotations. Suggesting people should not use stable and permanent features like enums and private fields just because they get transpiled into plain JS is a little ridiculous.
I'm not sure why someone would write an article warning people that some features of a superset language are not natively supported and need to be transpiled to the base language. That's literally the point of using a superset.
3
u/Blue_Moon_Lake Jan 19 '22
Soon : avoid using type hint in typescript, it's not native JavaScript !
5
u/Humberd full-stack Jan 18 '22
It looks like the author doesn't like when the compiler generates more JS code from Typescript. I wonder if he ever heard about compiling to ES5, where all the await doesn't look that nice anymore. Will he then discourage others from using async/await?
1
u/Leanwebstart Jan 19 '22
Really makes no sense to me. Why only use part of a language when you can get benefits from all of it.
Naturally if your head is still in Javascript mode, you might be tempted to use the minimum compatible set of features but then why bother...
I thought this anti typescript movement died 3 years ago...
4
u/Blue_Moon_Lake Jan 19 '22
"Avoid using enum" => the guy doesn't understand how to use enum, and doesn't know what a const enum is.