joarwilk / flowgen

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

Extra write-only property when not expected #197

Open FransBosuil opened 1 year ago

FransBosuil commented 1 year ago

A class that contains a GetAccessor and a SetAccessor with the same name is converted into a class that contains 2 properties with the same name but with different modifiers. The second modifier is "write-only" which makes the flow check throw a [cannot-read] error because the property is not readable.

Can you please indicate how this can be resolved without touching the typescript file? Thank you.

Input export declare class ABC { get id(): string | number; set id(value: number | string); }

Output declare export class ABC { id: string | number; -id: any; }

Error

Cannot get abc.id because property id is not readable. [cannot-read]

     419│           ....some((abc) => ids.has(abc.id))