全局
npm install -g flow-typed
目录根目录 flow-typed
userLibDef.js
declare function userlogin(a: number): string;
[ignore]
[include]
[libs]
./flow-typed
[lints]
[options]
[strict]
// @flow
function userlogin(index) {
return "dalongdemo"
}
const shortid = require("shortid");
function shortid_gen():string{
return shortid.generate()
}
function getinfo(name:string):string {
return name;
}
module.exports={
name:"dalong-appdemo",
age:33,
get:getinfo,
id:shortid_gen(),
login: userlogin(44)
}
https://flow.org/en/docs/config/
https://flow.org/en/docs/libdefs/creation/
原文:https://www.cnblogs.com/rongfengliang/p/9380680.html