-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
pr05 Typescript #1: Set up TS dependencies #3533
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
base: develop
Are you sure you want to change the base?
pr05 Typescript #1: Set up TS dependencies #3533
Conversation
🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. |
Thanks so much for putting this together!! I did some testing and changing a file from .js to .ts did work great, with the caveat that we need to change the import, as you already noted : D Forgive me for the basic questions, I'm a bit new to setting up this kind of build tooling haha but I glanced through some TS migration docs and had a few questions:
|
pr05 Typescript Migration: Set up TS dependencies:
Context:
Set up TS dependencies & developer tooling associated with
node v.16.14.2
&react v.16
typescript
:^5.8.3
-- stable withnode v18
@typescript-eslint/parser
:^5.62.0
@typescript-eslint/eslint-plugin
:^5.62.0
@babel/preset-typescript
:^7.27.1
@types/node
:^16.18.126
@types/react
:^16.14.0
@types/react-dom
:^16.9.25
@types/jest
:29.5.14
Add tsconfig and update developer tooling config for typescript
Changes:
Set up typescript (latest version):
typescript
:^5.8.3
@types/node
:^16.18.126
@types/react
:^16.14.0
@types/react-dom
:^16.9.25
tsc --build
from root)typecheck
&typecheck:client
Update babel (match to ts version):
@babel/preset-typescript
:^7.27.1
.babelrc
to add typescript presetUpdate eslint (match to ts version):
@typescript-eslint/parser
:^5.62.0
@typescript-eslint/eslint-plugin
:^5.62.0
ts
andtsx
files with ts parser & pluginslint-staged
,lint
andlint-fix
scripts to lint and fix ts and tsx files -- manually tested and confirmed that this workstest.ts
file in the client folder, which was missing ; and spaces, and confirmed these were caught inlint
and auto-fixed inlint-fix
Update storybook to include tsx files
Updated webpack config files to include
ts
andtsx
fileswebpack/config.dev.ts
webpack/config.examples.js
webpack/config.prod.js
webpack/config.server.js
Notes:
Manually tested automatic import resolves with js file using ts modules -- this doesn't work yet, but will try to resolve in the next PR to migrate
getConfig
.ts
or.tsx
to any files using migrated modules/componentsPrettier seems to be auto-formatting js files (eg. adding ; at the end of lines), but doesn't seem to do so for ts files
lint-fix
works, so this might not be an issue.Added jest types, but I have not manually tested migrating jest files yet. Will confirm in next PR to migrate
getConfig
if this is necessary/sufficientAdded react types, but will confirm if this is sufficient on a following PR to migrate an instance of a React component.
I have verified that this pull request:
npm run lint
)npm run test
)develop
branch.Fixes #123