Everyone who says: "Just rename your .js file to .ts and it's going to work instantly, no errors, don't need to rewrite anything. WELL FUCK YOU ALL! VS code says: 200 errors in a 100(!) line file.

  • 3
    Lol. Welcome to devRant.
  • 2
    @Floydimus Thank you! ;)
  • 2
    @Levminer You can simply separate tags using commas (,) :)
  • 1
    @Eklavya Well thank you! Now I see I fucked it up.
  • 0
    So you’re new to TypeScript…
  • 1
    Who's saying that... A high schooler?
  • 1
    Code might complain if you have a linter installed but as far as i know js code is always functionally valid ts.

    Typescript is a superset of js.

    But often in ts you add a linter to enforce better practices available in ts.
  • 1
    While you make the transition, set "allowJs" to true. You're getting 200 errors because that's the whole point of TS! Most of those are probably sythetic import, @type, and return errors. Totally common, and well worth it
  • 1
    I wasn’t sure if your rant was ironic or not until I’ve read the comments.

    When you switched from js to ts, basically your runtime errors have been converted to compile time errors.

    That‘s a good thing because now you can fix them easily without the need to debug.

    TS doesn‘t magically fix anything. It is just assisting you in fixing the errors by telling you exactly where they are.
Add Comment