-
Notifications
You must be signed in to change notification settings - Fork 560
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
Default import doesn't return a component after codebase was migrated to Typescript #434
Comments
This bug seems to be caused by upstream library, As a workaround, we could rename all |
Putting this on my plate for tomorrow morning. Thanks for raising the flag! |
I tried to simply rename all Meanwhile, I'm converting imports manually: import _VisuallyHidden from "@reach/visually-hidden"
export function interopDefault(obj) {
return obj.default ? obj.default : obj
}
const VisuallyHidden = interopDefault(_VisuallyHidden) AFAIK it only affects |
Just came here because of the broken Popover component export. But I guess that one doesn't count since it doesn't seem to be public. 😄 |
I had to use the workaround to get |
I patched the tsdx issue for the moment, so please try upgrading to 0.7.4 and let me know if anyone still has issues. Seems to be working fine on my end. |
I can confirm the issue is solved in |
🐛 Bug report
Current Behavior
VisuallyHidden
component causes error, because default import returns an object instead of a component:Expected behavior
Default import should return a component:
Reproducible example
Fresh Next.js install with only
Typescsript
and@reach/visually-hidden
dependencies.GitHub Repository
Suggested solution(s)
When I edit source of
visually-hidden.development.js
manually and change last lineexports.default =
tomodule.exports =
, then it works. It's either build issue or my tsconfig issue.Edit: It seems that build files are missing
Object.defineProperty(exports, '__esModule', { value: true });
line. Add this line to source solves the problem as well. I've checked tsdx, and it seems to be configured correctly (i.e. respectingesModuleInterop
settings fromtsconfig.json
)Additional context
Your environment
The text was updated successfully, but these errors were encountered: