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
For Draft (and other fbjs-based projects) we generate .js.flow files. We need to rewrite requires/imports in there, which we do via a babel transform. Ideally we'd only try to reprint that code instead of the whole tree (a la recast) but since the whole AST gets reprinted, it screws up in at least one case, optional object fields that are typed as functions.
I'm not a Flow expert so there might be another way to write the above code, but as written, it will get transformed to
declare type DraftEditorProps = {
blockRendererFn?(block: ContentBlock): ?Object
};
which is invalid syntax.
I created #3663 as a potential solution but I'm not quite sure if I'm keeping the right semantics (if I understood @thejameskyle correctly, it's probably ok and can just be a style bikeshed). It seems there isn't enough info in the AST to determine if we're looking at a property written this way vs the way that is currently generated.
The text was updated successfully, but these errors were encountered:
Input code
Description
For Draft (and other fbjs-based projects) we generate
.js.flow
files. We need to rewrite requires/imports in there, which we do via a babel transform. Ideally we'd only try to reprint that code instead of the whole tree (a la recast) but since the whole AST gets reprinted, it screws up in at least one case, optional object fields that are typed as functions.I'm not a Flow expert so there might be another way to write the above code, but as written, it will get transformed to
which is invalid syntax.
I created #3663 as a potential solution but I'm not quite sure if I'm keeping the right semantics (if I understood @thejameskyle correctly, it's probably ok and can just be a style bikeshed). It seems there isn't enough info in the AST to determine if we're looking at a property written this way vs the way that is currently generated.
The text was updated successfully, but these errors were encountered: