如何使用全局模块

问题描述 投票:2回答:1

所以我有

declare module "test" {
    declare export type running = number;
}

在一个lib文件中,我想知道如何使用这个模块,它到底有什么用。

如果我试着做这样的事情。

async function testMe (testing_stuff /* : test.running */) {
}

它不知道什么 test 是。

但如果我没有在一个模块中使用它,我可以直接使用 running

declare type running = number;

那就用它作为。

async function testMe (testing_stuff /* : running */) {
}

那么这里的模块有什么用呢?

javascript flowtype
1个回答
1
投票

你应该可以做到

/*:: import type { running } from "test"; */

async function testMe (testing_stuff /* : running */) {
}

从模块中导入类型。

© www.soinside.com 2019 - 2024. All rights reserved.