joarwilk / flowgen

Generate flowtype definition files from TypeScript
Other
657 stars 87 forks source link

fix: change Typecript RegExpMatchArray to Flow RegExp$matchResult #172

Closed yradchen closed 2 years ago

yradchen commented 2 years ago

Not sure if I put code in right spot, but this is to add support to RegExp$matchResult which has been in flow since at least version .100. Currently, if Typescript uses RegExpMatchArray it is not transpiled in Flow and remains RegExpMatchArray which doesn't exist in Flow and should be RegExp$matchResult.

Typescript code

export declare const getMatch: (text: string) => RegExpMatchArray;

Flow code BEFORE CHANGE

declare export var getMatch: (text: string) => RegExpMatchArray;

Flow code AFTER CHANGE

declare export var getMatch: (text: string) => RegExp$matchResult;
orta commented 2 years ago

Cool, looks reasonable to me