如何使用全局模块
How to use a global module
所以我有
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 */) {
}
那么这里的module有什么用呢?
你应该可以做到
/*:: import type { running } from "test"; */
async function testMe (testing_stuff /* : running */) {
}
从模块导入类型。
所以我有
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 */) {
}
那么这里的module有什么用呢?
你应该可以做到
/*:: import type { running } from "test"; */
async function testMe (testing_stuff /* : running */) {
}
从模块导入类型。