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)
| */ | ||
|
|
||
| export { EuiAccordion } from './accordion'; | ||
| export * from './accordion'; |
There was a problem hiding this comment.
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.
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/ |
thompsongl
left a comment
There was a problem hiding this comment.
LGTM 🥳
Built, checked packaged contents, checked eui.d.ts output, tested in Kibana.

Summary
closes #5034
What this PR does:
src/components/index.jsto.ts(9ce7d2b)src/index.jsto.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 buildin EUI passed with no typescript errorsyarn kbn boostrap --no-validatein Kibana passed with no errors when pointed at the built tgzyarn startin Kibana started with no errors, and styles/components loaded normally at a quick glance (including dark mode)node scripts/type_checkpassed 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