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
/Users/cedric/.../node_modules/prettier/doc.js:931
} else if (isConcat(doc) || doc.type === "fill") {
^
TypeError: Cannot read properties of undefined (reading 'type')
at fits (/Users/cedric/.../node_modules/prettier/doc.js:931:47)
at printDocToString (/Users/cedric/.../node_modules/prettier/doc.js:1073:44)
at coreFormat (/Users/cedric/.../node_modules/prettier/index.js:8838:22)
at formatWithCursor2 (/Users/cedric/.../node_modules/prettier/index.js:9021:18)
at /Users/cedric/.../node_modules/prettier/index.js:38183:12
at Object.format (/Users/cedric/.../node_modules/prettier/index.js:38197:12)
at print (/Users/cedric/.../node_modules/hermes-transform/dist/transform/print.js:88:25)
at translateFlowDefToTSDef (/Users/cedric/.../node_modules/flow-api-translator/dist/index.js:64:37)
Funny enough, using a named import actually works:
Small side note, when using export default $$..$$ that is a typeof MyClass, the generic is wiped away. It would be nice if this could be written as just export default MyClass instead - it would retain the generic.
Used package versions:
flow-api-translator@0.24.0
prettier@2.8.8
prettier-plugin-hermes-parser@0.24.0
Steps To Reproduce
npm i --save prettier@2.8.8 prettier-plugin-hermes-parser@0.24.0 flow-api-translator@0.24.0
Create test.js with:
constcode=`import * as Test from 'test-lib'class MyClass<T> extends Test.BaseClass {}export default MyClass`require('flow-api-translator').translateFlowToTSDef(code,{parser: 'babel'}).then(console.log)
node ./test.js
The Expected Behavior
It converts the flow code to a typescript definition for named and namespace imports.
The text was updated successfully, but these errors were encountered:
Bug Description
The
flow-api-translator
has been a blessing. Unfortunately, I ran into a bug specifically when:E.g.
This results in the following error:
Funny enough, using a named import actually works:
Used package versions:
flow-api-translator@0.24.0
prettier@2.8.8
prettier-plugin-hermes-parser@0.24.0
Steps To Reproduce
npm i --save prettier@2.8.8 prettier-plugin-hermes-parser@0.24.0 flow-api-translator@0.24.0
test.js
with:node ./test.js
The Expected Behavior
It converts the flow code to a typescript definition for named and namespace imports.
The text was updated successfully, but these errors were encountered: