Depends on what you are comfort with. :) I don't think one is better than other.
010001111268328d@kristofersoler uhm yes it is, typescript and type safety are super important for scalability.
Additionally the ecoworld of typescript is usually easier to work with. You can do a heck lot more wrong with vanilla js, especially if you are not 100% sure what you’re doing of have limited knowledge about it.
@010001111 hmmm... thats true. 🤔🤔 but that depends or what you are working on. Depends on the project and other things (like scalability).
If I want to make a To-Do list I dont think one is better than other, just work with the language is more easy for you.
Thats what I wanted to mean.
theuser505328dIf you need to handle lots of business data from APIs, which in turn means you have to work with lots of complex objects, then typescript is a good candiate. Otherwise, you would have to do a lot more JSDoc.
Typescript aid you in type safety, but this is only relevant at compile time. TS or not, you have to spend time type checking your stuff. TS will not guard you against cheeky API changes.
JS is fine for smaller apps, but then again react is probably not the right framework choice there.
webketje83328dTypescript is a pain in the ass when combined with React. Prepare for adding a lot of //@ts-ignore and prop:any types, or spend hours debugging chains of complex type structures extending one another.
Eventually the result CAN be more robust code (in projects I've worked on, it seldom is). But regardless of whether it will be, it WILL impose a cognitive overhead. E.g. you have to think of every React event listener: wait, is this a React.SyntheticEvent, MouseEvent or KeyboardEvent.. What if it gets executed with different events?
As for documenting methods and parameters, JSdoc is good enough and, unlike Typescript, does not block your build or spam warnings when you leave one undocumented.
dder207127dI’m a big fan of Typescript, and can confirm what others said here.
What makes you stick to React ? Have you considered other Frameworks, if you can ? I’m very happy with vuejs.
Vanilla js and coffeescript will cause you extra bum hair
volttide48727dI use typescript for the autocomplete lol
bashleigh403927dTypescript. Because the compiler will moan at you more than your clients when shit dun wurk