joarwilk / flowgen

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

Clear up a few `any` types #178

Closed gnprice closed 2 years ago

gnprice commented 2 years ago

The any types in the index.js.flow file, combined with the @flow strict at the top, cause Flow to give errors when run with a typical .flowconfig, one with the recommended set of lints under [strict].

That in turn happens when running Flow on a project that uses this one, if using yarn link to use a checkout of the Flowgen repo instead of a copy of the built artifact from NPM. Which is a handy thing to do when developing changes to Flowgen and testing them in a project that uses it.

Instead, to avoid those errors, we can just say $FlowFixMe. It has the same semantics as any, but because it explicitly acknowledges that something's missing, the strict-mode linters don't complain about it.

Also add tiny comments to indicate what the types are really supposed to be. While looking those up, we find that one of them is any in the actual implementation, but easily fixed; fix that too.

orta commented 2 years ago

Cool, makes sense to me - thanks for the detailed writeup

gnprice commented 2 years ago

Thanks for the swift review and merge!