enable TS compiler option: strictBindCallApply#14685
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52325/ |
| 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.
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
assertionstype definition toDeclareExportDeclarationand add the generator support - Throw an error (i.e. JSON modules are not yet supported in Flow) when DeclareExport*Declaration have
assertionsand 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.
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.
@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.
Yes, I prefer to disable them before they actually work.
Enabled the TS compiler option
strictBindCallApplyand fixed such typing errors.