【发布时间】:2017-11-24 03:12:59
【问题描述】:
我发现了一个有趣的包并想在我的打字稿应用程序中使用它:https://github.com/dsherret/ts-nameof
但我无法导入nameof 函数。它没有在 d.ts 文件中导出:
declare module "ts-nameof" {
interface Api {
...
}
var func: Api;
export = func;
}
declare function nameof<T>(func?: (obj: T) => void): string;
declare function nameof(obj: Object | null | undefined): string;
declare namespace nameof {
function full<T>(periodIndex?: number): string;
function full(obj: Object | null | undefined, periodIndex?: number): string;
}
我应该如何将nameof 函数导入我的打字稿模块?
对于import 'ts-nameof'; 我有Uncaught ReferenceError: nameof is not defined 错误。
【问题讨论】:
标签: javascript typescript