-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Split types into their own imports / exports #41285
Conversation
Also prevents JS file from attempting to export TS types.
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~109 bytes removed 📉 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
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.
Looks good to me! Tested composite checkout and nothing appears broken.
Thank you for doing this!
Should we explore the
I've been reluctant to start using type imports because I'd read that it will mostly be unnecessary, however I believe that's true with the TypeScript compiler ( |
@sirreal It isn't clear to me whether the errors this PR is trying to fix are caused by mixed imports or mixed exports. One error that is clear, however, is that there is a JS file trying to export TS types, which shouldn't happen. Now, the reason I opted for separating things into If a TS file exports both types and JS constructs with the same For those reasons, I would vote for always keeping types and JS constructs separate, in their own |
I'm OK with trying this direction. |
There are currently a number of warnings in the build process, related to how
composite-checkout
is importing and exporting TypeScript types.This PR fixes that, by importing and exporting types separately from actual JS constructs.
It also prevents a JS file from attempting to export TS types.
Note that this PR includes a temporary directive to disable an ESLint rule, because of an ongoing bug in its plugin (
eslint-plugin-import
) with TS 3.8 (see this bug).Changes proposed in this Pull Request
Testing instructions
composite-checkout
are gone.composite-checkout/wpcom
-related functionality still works?This PR mostly fixes #41113, with one warning (in an external package) remaining.