how to publish a flow-typed library with its own types

Viewed 172

I've written a index.js module in flow which I transpiled with Babel, placed within a /dist directory and defined as the main file in the package.json:

{
  "name": "my-lib",
  "version": "0.9.0",
  "description": "...",
  "main": "dist/index.js",
...
}

the dist directory only contains the transpiled file.

when I use it on another project, by importing via npm or yarn (yarn add <my-local-path-to-the-module>), I can import into my project's modules but I lose the original flow definitions (of course, babel stripped them). How could I associate the flow definitions along with the transpiled file so as to have the module as well as its Flow types ready to use?

1 Answers
Related