繁体   English   中英

如何使用全局模块

[英]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 */) {
}

从模块中导入类型。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM