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
enable TS compiler option: strictBindCallApply #14685
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52325/ |
@@ -81,6 +81,7 @@ export function ExportAllDeclaration( | |||
this.word("from"); | |||
this.space(); | |||
this.print(node.source, node); | |||
// @ts-expect-error Fixme: assertions is not defined in DeclareExportAllDeclaration |
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.
Currently the flow parser plugin accepts
declare export * from "./module.json" assert { type: "json" }
declare export * as ns from "./module.json" assert { type: "json" }
declare export { default } from "./module.json" assert { type: "json" }
None of them are supported by Flow as of Jun 2022.
However only
declare export * from "./module.json" assert { type: "json" }
works on generator because the DeclareExportAllDeclaration reuses the ExportAllDeclaration printer.
There are two solutions:
- Add the missing
assertions
type definition toDeclareExportDeclaration
and add the generator support - Throw an error (i.e. JSON modules are not yet supported in Flow) when DeclareExport*Declaration have
assertions
and remove the generator support mentioned above
While I personally think Flow should eventually support declared JSON modules imports. I am good with either supporting it prior to the Flow project or disabling it.
Note that
declare export default from "./module.json" assert { type: "json" }
is not supported when Flow
and exportDefaultFrom
are both enabled, though the error message "Missing semicolon. (1:27)" after from
is not very helpful.
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.
While I personally think Flow should eventually support declared JSON modules imports. I am good with either supporting it prior to the Flow project or disabling it.
I tend to do that too.
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.
@liuxingbaoyu I am not sure I can follow. Do you tend to agree that we should support import assertions in Flow declare exports or disallow it (like Flow current does)?
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.
Yes, I prefer to disable them before they actually work.
Enabled the TS compiler option
strictBindCallApply
and fixed such typing errors.