DEV Community

Discussion on: Why You Should Use Typescript Over Javascript?

Collapse
 
haaxor1689 profile image
Maroš Beťko

None of the points you've mentioned there are points against using typescript. I would argue there isn't a single project that you shouldn't use Typescript on. Even if you just add a bare minimum non-strict tsconfig and use no explicit types at all it's basically javascript but safer. You can't be bothered by thinking about what your function arguments types should be? Just use any and go the js way. But don't complain when half your codebase catches fire in 2 months after you decide to do a seemingly unrelated refactor.

Collapse
 
rammina profile image
Rammina

Let me ask you questions:

  • would you use Typescript if an important library you will be using has no type definition files?
  • do you think it is worth writing type definition files down yourself?
  • are you sure that using any over and over again will not have any negative consequences or create a false sense of security for a development team that uses Typescript?
Collapse
 
shreyanshsheth profile image
Shreyansh sheth

any is only useful when you are stuck in something that does not have type defs and also when you are working with some javascript library that does not have any types. also note that i wrote starting out with loose typescript configuration and make it strict along the way.

Thread Thread
 
haaxor1689 profile image
Maroš Beťko

Not even for that. You shouldn't use any at all and use unknown and never instead. I've used any as an example for someone who doesn't really want to use typescript.

Thread Thread
 
shreyanshsheth profile image
Shreyansh sheth

i 100% agree that any is the troublemaker and we should be using never & unknown.