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:
|
…tDate.ts is not staged
|
@khanniie Thanks so much for reviewing! I made the following updates following our catchup last week and the PR review comments above:
|
.storybook/main.js
Outdated
| /** @type { import('@storybook/react-webpack5').StorybookConfig } */ | ||
| const config = { | ||
| stories: ['../client/**/*.stories.(jsx|mdx)'], | ||
| stories: ['../client/**/*.stories.(jsx|md|tsx)'], |
khanniie
left a comment
There was a problem hiding this comment.
This looks great! thanks so much, Claire! and thanks for the formatting fixes as well : D
|
Thanks so much @clairep94 and @khanniie! I think this looks good to go! Will give a second to double check the next PR before getting that one in too! |


pr05 Typescript Migration: Set up TS dependencies:
Context:
Set up TS dependencies & developer tooling associated with
node v.16.14.2&react v.16typescript:^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.14Add 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.25tsc --buildfrom root)typecheck&typecheck:clientUpdate babel (match to ts version):
@babel/preset-typescript:^7.27.1.babelrcto add typescript presetUpdate eslint (match to ts version):
@typescript-eslint/parser:^5.62.0@typescript-eslint/eslint-plugin:^5.62.0tsandtsxfiles with ts parser & pluginslint-staged,lintandlint-fixscripts to lint and fix ts and tsx files -- manually tested and confirmed that this workstest.tsfile in the client folder, which was missing ; and spaces, and confirmed these were caught inlintand auto-fixed inlint-fixUpdate storybook to include tsx files
Updated webpack config files to include
tsandtsxfileswebpack/config.dev.tswebpack/config.examples.jswebpack/config.prod.jswebpack/config.server.jsNotes:
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.tsor.tsxto 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-fixworks, 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
getConfigif 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)developbranch.Fixes #123