-
Notifications
You must be signed in to change notification settings - Fork 860
Use export type syntax
#5554
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
Use export type syntax
#5554
Conversation
+ add parserOptions.project required by new rule + add .eslintrc.js files to .eslintignore, to stop vscode errors about the new project key (see typescript-eslint/typescript-eslint#1723)
Not sure if this is the best approach, will ping Greg
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5554/ |
|
🎉 Confirmed that type exports are stripped from the es builds, most notably the optimize build without our custom babel plugin. Going to do some more testing around this to see if we can get further time improvements or config simplifications. |
I think the only thing we need to do is adjust the |
|
Sweet! Just to check, do you want me to keep going with this PR or do you want to take it over? |
|
I can push some changes at the very least 👍 |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5554/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5554/ |
| }); | ||
| }); | ||
|
|
||
| describe('remove types from exports', () => { |
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.
This is all handled by babel now outside of our custom plugin 🎉
The redundant code in the plugin has also been removed
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.
As it turns out, I'll also need these tests removed to upgrade Typescript to 4.5.x (it starts outputting export {} instead of a blank string once upgraded 🤷♀️), so glad that we jumped on this tech debt item sooner rather than later!
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5554/ |
|
Nice!! Just so I'm on the same page - we still need |
Correct. That and the function that used to remove type exports. |
|
Do you think this is ready to move out of draft in that case once CI/tests pass? |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5554/ |
chandlerprall
left a comment
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.
Wooo!
✅ Code deletion
✅ More explicit organization
✅ Aligning with community standards
Tested:
yarn buildand spot-checked some files in es and lib to ensure types are still omittedyarn startand compared Props tabs between local & published docs- verified proptypes are still generated in the build output as expected
- verified eslint complains about non-type type exports, and that
--fixsolves
|
Wahoo! |
Summary
closes #5552
Upgrades
@typescript-eslintto latest, adds@typescript-eslint/consistent-type-exportsrule, and runs--fixon src/ exportsThis converts our type exports to use
export typeinstead of just plainexport,but does not do any extra work around removingproptypes-from-ts-propsor updating our compile scripts - I was hoping @thompsongl could carry the PR the rest of the way 🤞proptypes-from-ts-propsremains, but has been modified to remove 1) the configuration to prevent propType generation, and 2) theexitmethod to strip type exports fromesbuild (handled elsewhere by babel now).QA