You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The resolved types use export default where the JavaScript file appears to use module.exports =. This will cause TypeScript under the node16 module mode to think an extra .default property access is required, but that will likely fail at runtime.
Expected behavior
These types should use export = instead of export default.
I spent some time understanding this issue, here are my findings
Since output generated is in cjs format it results in module.exports output. d.ts file should have typescript export = instead of export default since output is cjs.
The functionality which generates the types today ( .js -> .flow -> .d.ts ) there is no way for us to tell translateFlowDefToTSDef to use export = instead of export default
I tried changing export in index.js from export default to common js module.exports but it throws error in translateFlowDefToTSDef method.
Describe the issue
The resolved types use
export default
where the JavaScript file appears to usemodule.exports =
. This will cause TypeScript under thenode16
module mode to think an extra.default
property access is required, but that will likely fail at runtime.Expected behavior
These types should use
export =
instead ofexport default
.Steps to reproduce
See https://arethetypeswrong.github.io/?p=%40stylexjs%2Fbabel-plugin%400.10.1
Test case
No response
Additional comments
No response
The text was updated successfully, but these errors were encountered: