-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: migrate to TypeScript #1134
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- You'll want to add a
prepack
script that runstsc
to automatically transpile TypeScript to JavaScript when packaging. Implicitly this will fail if there are any TypeScript errors. (However, better not add those *.js files to the.gitignore
, because it just makes it harder to debug.) - You need to update those scripts that run
*.js
files to callts-node
with the*.ts
file instead.
@caugner Thank you for the guidance, CI/CD was the hardest part for me to figure out. Could you please recheck, when you have a minute? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good, and the passing tests confirm this, but maybe @queengooborg could take a second look to make sure I didn't miss anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's take advantage of SWC here as well, help keep things speedy throughout all our repos!
npm i -D @swc/cli @swc/core
And in tsconfig.json:
{
...
"ts-node": {
"esm": true,
"files": true,
"swc": true
}
}
Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <[email protected]>
@queengooborg Thanks a lot for all of the suggestions. Could you please recheck? |
This PR adds TypeScript to the project. I intended to make as small amount of changes as possible, so it's easier to review.
@typescript-eslint/recommended
has a bit more restrictive rules than what was previously present. Because of that, changes inconsole-utils.test.js
andeditable-wat.js
were required.lib
files to TS. I didn't change extensions of files fromeditor/js
because there are A LOT of errors that would have to be fixed.cosmiconfigSync
. I have removed them, ascosmicconfig
documentation doesn't bring them up and the function works exactly the same way without them.If everything looks to be fine, I will convert the rest of the files to
.ts
and add types.