Closed AlexanderOtavka closed 7 years ago
I think I can do it this weekend. And I don't think that supporting both flow libdef and d.ts typings is a real issue, because it's only API surface, which shouldn't change on patch releases
Thanks for tackling this @Hypnosphi!
As stated in #160, I don't have the experience to properly review the typings. If anyone else sees this and can lend a hand, I'd appreciate it! Otherwise they'll ship in the next patch release and any Typescript issues can be subsequently addressed.
Also, if there is a way to generate Flow typing from Typescript, it may be worth investigating, to reduce the risk of them getting out of sync? But yeah it's not a major issue IMO since the surface API doesn't change often.
I'm not a big fan of such an automation, honestly. The quality will suffer, plus there are major differences in how React is typed in TS vs Flow. For example, in React.ReactElement
in TS is an interface, but React$Element
in Flow is a class.
I'm not a big fan of such an automation, honestly. The quality will suffer, plus there are major differences in how React is typed in TS vs Flow. For example, in React.ReactElement in TS is an interface, but React$Element in Flow is a class.
Fair enough! I'm happy to not try to overengineer it.
One concern I have is that I may forget to update typescript definitions before a minor or major release... maybe I can look into adding a prepublish hook that prompts the publisher on non-patch releases to check that typescript and flow annotations are both updated
I've done a little research, and I can't find a way to generate .d.ts files from flowtype files, although going the other direction seems doable. Ideally, we could generate these typings from our flowtype information so TypeScript users can get the same benefits of static typings and we wouldn't have to maintain separate typing information for TypeScript that could fall out of date.