flowgen
flowgen copied to clipboard
Parsing error: Identifier 'xyz' has already been declared
Hi, I was wondering how should I handle this kind of TypeScript annotations:
https://github.com/ianstormtaylor/slate/blob/main/packages/slate-react/src/plugin/react-editor.ts#L29-L34
export interface ReactEditor extends Editor {
insertData: (data: DataTransfer) => void
setFragmentData: (data: DataTransfer) => void
}
export const ReactEditor = {
// etc...
Flowgen converts it to:
declare export type ReactEditor = {
insertData: (data: DataTransfer) => void,
setFragmentData: (data: DataTransfer) => void,
...
} & Editor;
declare export var ReactEditor: {
// etc...
but then Flow errors because:
Parsing error: Identifier 'ReactEditor' has already been declared
Any help would be appreciated.
If flow doesn't support a type and a value having the same name, I don't think anything could be done here in a way that won't break the importing code realistically.
Could flowgen allow to prefix types to prevent these issues?
Maybe as an option? Could work for me