facebook / facebook/flow

Best Practices for 3rd party authoring

オープン
#2,108 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る
declarations question
主要言語
Rust
スター
22.3k
フォーク
1.9k
PR マージ指標
30日以内にマージされた PR はありません

説明

Hello!

I'm new to flow and I'm trying to get flow to work right in this lib https://github.com/letsroundup/react-native-localytics we open-sourced recently.

I've noticed that when I have a project that includes it directly from the npm package name, I get a module not found error from flow. If I require it from the name given in [providesModules](https://github.com/letsroundup/react-native-localytics/blob/master/VOOLocalytics.ios.js#L2) things are getting flow'd correctly.

Though that feels weird because people are used to require libs from their package name, not their providesModule name. Should I change the providesModule name to be the same as the package name? In that case it would be `@providesModule react-native-localytics`. When I do that flow works as expected.

I'm not sure what the correct answer is here, but I guess it would make sense that a module "provides" with the same name as the npm package name.

Or should I use another approach and ship a .js.flow somewhere or anything else?

---

Also, how should I export the types needed for annotations. Example: one of my function needs CustomerParams to be passed. How can I retrieve that annotation properly from the project that uses this library. Should it be exported from from the main file? Or is there a "standard" name for a file that would export all the type that could be required from the project and then used.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。