【问题标题】:how to declare modules that has other modules in Flowtype?如何在 Flowtype 中声明具有其他模块的模块?
【发布时间】:2016-12-12 23:08:33
【问题描述】:

我有一个简单的包,由一个 index.js 组成,其中包含 myservices.js,后者进一步需要 net.js 和 info.js, 如何在 flowtype 中声明这个包?谢谢,

// myservices.js
"use strict";

module.exports.net = require('./net.js')
module.exports.info = require('./info.js')


// index.js
module.exports = require('./build/lib/myservices');

【问题讨论】:

标签: flowtype


【解决方案1】:

到目前为止,以下作品:

type netT = {
  get_info : (URL : string) => any
}

declare module 'myservices' {
    declare var net : netT
    declare var info : any
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-02-26
    • 1970-01-01
    • 1970-01-01
    • 2020-09-22
    • 2014-04-30
    • 2013-03-08
    • 2021-11-09
    • 1970-01-01
    相关资源
    最近更新 更多