-
Notifications
You must be signed in to change notification settings - Fork 350
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
fix(ToolTip/index.ts): Exports TooltipProps as a type to help babel. #4854
fix(ToolTip/index.ts): Exports TooltipProps as a type to help babel. #4854
Conversation
TooltipProps is exported but contains only TS code. Babel removes this at compile time throwing an error with --isolatedModules flag. 4853
PF4 preview: https://patternfly-react-pr-4854.surge.sh |
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.
It seems like 'TooltipProps' was incorrectly exported in the first place.
Seems that there are more cases in the codebase the Properties types are exported - but honestly I don't see the usecase for it.
Unless you have a usecase to use it, I would rather not export it.
…ort of TooltipProps type Export of TooltipProps type causes issues with babel's --isolatedModules flag 4583
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 won't work either - CI fails with:
packages/react-table/src/components/Table/base/types.tsx:9:10 - error TS2305: Module '"../../../../../react-core/dist/js"' has no exported member 'TooltipProps'.
9 import { TooltipProps, PopoverProps } from '@patternfly/react-core';
~~~~~~~~~~~~
packages/react-table/src/components/Table/HeaderCellInfoWrapper.tsx:5:36 - error TS2305: Module '"../../../../react-core/dist/js"' has no exported member 'TooltipProps'.
5 import { Button, Tooltip, Popover, TooltipProps, PopoverProps } from '@patternfly/react-core';
~~~~~~~~~~~~
and much more errors since they expect in many places that that property is globally exported.
I am wondering if the correct approach is to remove it as you did and then import from direct file:
import { TooltipProps } from '@patternfly/react-core/src/components/Tooltip/Tooltip
in all internal usages of it.
Maybe we should just not export it as a type and put it bellow with the other exports. Maybe @redallen could give a better solution.
Sorry about the multiple failures. I think the first solution was probably the most benign one: my understanding is that exporting as type (e.g. |
Sure - sorry for misleading. Would you like to also update packages/react-core/src/components/Popover/index.ts ? |
Yep, will do. It's probably going to be at the end of the work day though (US time). |
Hey @gradybknight, I'm a little confused why you are using babel on You can easily support the Thanks!
|
4b77ee8
to
88e211c
Compare
Codecov Report
@@ Coverage Diff @@
## master #4854 +/- ##
=======================================
Coverage 52.73% 52.73%
=======================================
Files 525 525
Lines 9473 9473
Branches 3486 3486
=======================================
Hits 4996 4996
Misses 3848 3848
Partials 629 629
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
TooltipProps is exported but contains only TS code. Babel removes this at compile time throwing an
error with --isolatedModules flag.
4853
What: Closes #4853
Additional issues: n/a