3 ms·
If I understand correctly, they convert the js file to .ts file, ask tsc for error diagnostics and automatically apply transformations to resolve those errors w
by nojvek 6y ago
If I understand correctly, they convert the js file to .ts file, ask tsc for error diagnostics and automatically apply transformations to resolve those errors when they can.
Yep that’s how I’d do it too. I wrote a simpler version when doing a tsc upgrade to resolve a whole bunch of errors. It parses the tsc errors and does simple string replaces.
Has anyone played with the tool to report how good it is?
I remember v8 did an experiment back in the day where it would run code and profile the input parameters and output of functions and automatically generate typescript types.
- triyambakam 6y agoI hadn't heard of that, but there is the typewiz project - https://github.com/urish/typewiz https://github.com/urish/typewiz
- swyx 6y agoI keep a list of migration tools here fwiw https://github.com/typescript-cheatsheets/react/blob/master/docs/migration/from-js.md#automated-js-to-ts-conversion https://github.com/typescript-cheatsheets/react/blob/master/...