-
Notifications
You must be signed in to change notification settings - Fork 337
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
Internal: TypeScript Migration #3567
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jackhsu978
force-pushed
the
ts
branch
5 times, most recently
from
May 14, 2024 23:44
3e8886b
to
3563b49
Compare
✅ Deploy Preview for gestalt ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
jackhsu978
changed the title
Internal: TypeScript Migration
Breaking Change: TypeScript Migration
May 15, 2024
jackhsu978
changed the title
Breaking Change: TypeScript Migration
Internal: TypeScript Migration
May 15, 2024
jackhsu978
force-pushed
the
ts
branch
4 times, most recently
from
May 15, 2024 20:30
baa2448
to
0fa6f50
Compare
This was referenced May 15, 2024
jackhsu978
force-pushed
the
ts
branch
3 times, most recently
from
May 16, 2024 01:48
06a2b66
to
7649fa2
Compare
5 tasks
AlbertCarreras
approved these changes
May 16, 2024
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.
CANT WAIT
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR migrates from Flow-typed JavaScript code to TypeScript code.
Breaking Change
We are dropping the Flow typing support for Gestalt!
Starting in Gestalt v148, Flow typings will not be exported. We will only export TypeScript typings going forward.
Q&A
Why migrate codebase to TypeScript?
Because we have decided to make TypeScript our standard language for all Pinterest web projects.
Why drop Flow support?
Maintaining both TypeScript and Flow typings requires significant amount of manual work. Since our active internal web clients consuming Gestalt have already been migrated from Flow to TypeScript, the additional work is not worth it.
Which directories are migrated?
/docs/
/packages/gestalt/src/
/packages/gestalt-charts/src/
/packages/gestalt-datepicker/src/
Why not migrate all directories?
While it's our goal to convert all Flow-typed JavaScript files to TypeScript files, it's low priority to migrate the internal code and potentially removable code (such as Gestalt upgrade codemod).
Why do we still have
flow-typed
directory?This is because not all JavaScript code is migrated to TypeScript. Nonetheless, this PR removes most of the Flow library definitions.
Why change
Element<typeof X>
toReactElement
?In TypeScript, it's not possible to limit a render prop to be a React element of a specific React component. See this doc
Why upgrade
date-fns
/@mui/x-date-picker
?date-fns
v2 in some areas and v3 in some other areas. Upgrading makes it consistent.date-fns
requires@mui/x-date-picker
to also be upgraded. See [pickers] Error loading AdapterDateFns with date-fns v3 in vite: Missing "./_lib/format/longFormatters" specifier in "date-fns" package mui/mui-x#12144Why add
acornInjectPlugins
to rollup config?See https://www.npmjs.com/package/@rollup/plugin-typescript#preserving-jsx-output
Why
docs/tsconfig.json
anddocs/next-env.d.ts
?The two files are actually auto-generated when I run
yarn start
locally. These files should not be manually edited.Why check-in
tsMigrate.sh
?The file isn't actually necessary and can be removed. I am just leaving it in for future reference.