joarwilk / flowgen

Generate flowtype definition files from TypeScript
Other
658 stars 78 forks source link

template literals support: Only declares and type imports are allowed inside declare module. #188

Open unional opened 2 years ago

unional commented 2 years ago

Seems like there is a bug when transforming template literals:

export type StoreVersion = `${number}.${number}.${number}` | number;

transforms to:

declare export type StoreVersion = undefined: /* NO PRINT IMPLEMENTED: TemplateLiteralType */ any | number;

Which flowgen crash caused by SyntaxError when checking by pretter:

SyntaxError: Only declares and type imports are allowed inside declare module

I have a repo here: https://github.com/unional/global-store/tree/flow (pnpm build:flow)

orta commented 2 years ago

Nice find, open to a fix