Flow: DeclareModuleExports should take a TypeAnnotation
ben-chin opened this issue · comments
Hi! Firstly, I'm having a great time using recast
and ast-types
to code generate some flow library definitions, so thanks for all the dope work :)
I was attempting to build a module declaration that exports a CommonJS module a la the flow docs when I ran into an issue.
declare module "some-module" {
declare module.exports: {|
someExport: number,
|};
}
It looks like the definition that was added in benjamn/ast-types/pull/162 expects a typeAnnotation
field that is a def("Type")
.
From what I can see from the docs and the ast generated at flow.org/try, it should take a typeAnnotation
, and a similar PR that tried to introduce DeclareModuleExports
actually had this correct before being superseded: benjamn/ast-types/pull/169.
This is my first foray into recast
and ast-types
so please let me know if I'm misunderstanding! Happy to make a PR and test case if we're agreed this should be the expected behaviour!
@ben-chin I believe your analysis is correct! Would you mind submitting a quick PR to use def("TypeAnnotation")
instead?