3 ms·
A bit unrelated, but yesterday, after beeing fed up trying to fix unexpected behaviors of a js code base, i decided to rename my file .ts and compile it with ty
by bsaul 12y ago
A bit unrelated, but yesterday, after beeing fed up trying to fix unexpected behaviors of a js code base, i decided to rename my file .ts and compile it with typescript. Without doing anything, the compiler found type mistakes and variable declaration errors.
And now today i'm coding in typescript adding type informations wherever i think it could be useful, and looking at typescript documentation to see in which way i could refactor my code to make it safer.
That's probably the fastest migration process you could imagine. Maybe dart would be more popular if they chose that route.
- allendoerfer 12y agoMaybe you should use JSHint. You can configure your editor to run it automatically. It is a bit unfair to compare TypeScript with its compiler against raw JavaScript, when the JavaScript ecosystem has tooling, too. I am not argueing, that TypeScript is not the safer or even better choice, I am just saying, that a properly set up JavaScript environment could have saved you the hassle as well.
- girvo 12y agoInterestingly, that's what Facebook's Flow type analyser is built to do: allow you to type-check normal JS code, and add types where needed in the codebase. [0] http://flowtype.org/ http://flowtype.org/