I use Flow to help the author of the JS project. If I want to provide a libdef file in addition to it, I need to create it manually or I can execute some magic command so that I donβt know what lib def will generate for me?
Something like $ flow-typed doyourmagic would be nice.
EDIT:
Found this overflowing
What says:
There are two things:
If the file belongs to you (i.e. it is not a third-party lib inside node_modules or such), you can create a * .js.flow file next to it that documents its export.
If the file does not belong to you (i.e. a third-party library inside node_modules or such), then you can create a libdef file inside flow-typed / name-of-library.js
For .js.flow files, you write the definitions as follows:
// @flow declare module.exports: { ... }
For libdef files, you write the following definitions:
declare module "my-third-party-library" { declare module.exports: {... } }
On my question, I get to the camp "belongs to you."
I guess I'm confused:
- How do I write these files.
- How / where I publish these files to package it for reference to another project.
Also, why do I need to create a .js.flow file manually? Could this be magical? Perhaps this intention continues, but has not yet been realized.
source share