-
Notifications
You must be signed in to change notification settings - Fork 844
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
Convert remaining .js
files in src/
to .ts
#5044
Conversation
- which involves adding an index.d.ts to packages for react datepicker
Credit to Greg for the original fixes
(in order to include/export types)
@@ -6,328 +6,165 @@ | |||
* Side Public License, v 1. | |||
*/ | |||
|
|||
export { EuiAccordion } from './accordion'; | |||
export * from './accordion'; |
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.
I believe this src/components/index.ts
change is required for Kibana/other apps to correctly import EUI type definitions - without this change, I was seeing the following types of errors during Kibana's yarn bootstrap step:
info [bazel] packages/kbn-securitysolution-autocomplete/src/field/index.tsx:10:23 - error TS2305: Module '"@elastic/eui"' has no exported member 'EuiComboBoxOptionOption'.
info [bazel]
info [bazel] 10 import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui';
I copied this export *
solution from @thompsongl's previous PR in an attempt to fix the above error, and it appears to have done so, but I'd definitely appreciate a sanity check on whether both the problem and this solution are valid, or if we might run into unexpected errors as a result of over-exporting in the future. 🤔
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.
Yes, we now need to export the types from this file and the *
approach makes sense because the list of exports coming from the individual component index.ts
files is curated.
👋 Hey Chandler and Greg! This PR is working for me locally in both EUI and Kibana, but I'm not super confident in my Typescript project/config-fu and would love someone to double check that my QA steps also pass for them locally. I've already hit my quota of breaking Kibana master this month, haha 😅 I could also use some guidance based on this PR what exactly from the checklist needs to be QA'd and what doesn't - in theory since this affects the entire project the answer could be "yes, everything", but in practice I'm not 100% sure. Additionally, does this PR require a CHANGELOG entry as well since it's in |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5044/ |
jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5044/ |
Yeah this falls into some gray area. I think the QA list you added is more appropriate than the standard Checklist. Probably still worth building and spot checking the docs, but the downstream/Kibana steps are more likely to catch bugs. |
I built a tgz and ran bootstrap in Kibana, and got a few errors like above. Looks like we may also want to export |
ARGH haha sorry, I saw that in your original PR but didn't see a |
- I think it was caused by the common.ts export? Not totally sure why it only just started happening - PR is slowly just becoming Greg's old PR over time ha
OK, I think this new set of commits/changes should be ready to test again with I did have to run |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5044/ |
I'm still getting errors like above during bootstrap, after a clean |
Hm, super bizarre (also not sure why my local Kibana isn't having issues). Do you have any idea how to fix that specific error Greg? I tried doing |
Might be a false alarm on my part. Checking. |
Just tried again with latest master kibana and latest master EUI merged into this branch and didn't get any errors on build or bootstrap 🤔 LMK if I can help or hop on a call! |
☝️ Tracked the discrepancy down to using |
- Per Greg's eagle eyes, `yarn pack` was failing to bundle/include the `src/test/` folder somehow and causing test failures for plugins in Kibana trying to import `lib/test/` helpers - `npm pack` doesn't have this issue, so I opted to create a new command that enforces npm pack over yarn pack
27ccfd3 should address enforcing |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5044/ |
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.
LGTM 🥳
Built, checked packaged contents, checked eui.d.ts output, tested in Kibana.
Summary
closes #5034
What this PR does:
src/components/index.js
to.ts
(9ce7d2b)src/index.js
to.ts
(98542a6)yarn build
/tsc --noEmit -p tsconfig-builttypes.json
(d8733a7)*
wildcard exports (373e92c)I leaned hard on Greg's previous PR #4695 for this work - thanks for doing the heavy lifting @thompsongl!
What this PR does not do:
QA
yarn build
in EUI passed with no typescript errorsyarn kbn boostrap --no-validate
in Kibana passed with no errors when pointed at the built tgzyarn start
in Kibana started with no errors, and styles/components loaded normally at a quick glance (including dark mode)node scripts/type_check
passed in Kibana with no errorsChecklist
- [ ] Checked in mobile- [ ] Checked in Chrome, Safari, Edge, and Firefox- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation- [ ] Checked Code Sandbox works for the any docs examples- [ ] Added or updated jest tests- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes