Typescript 如果可以';不进口?

Typescript 如果可以';不进口?,typescript,momentjs,Typescript,Momentjs,我试图使用矩类型定义,模块设置为“无”,但无论我做什么,我都会得到 error TS2304: Build:Cannot find name 'moment'. 在我的tsconfig中,我已经将“矩”添加到类型列表中(该列表包含并适用于angularjs),并尝试将“node_modules/moment/moment.d.ts”添加到我的includes中,但都不起作用 打开日志记录后,我可以看到正在加载力矩类型定义的类型: ======== Module name 'moment' wa

我试图使用矩类型定义,模块设置为“无”,但无论我做什么,我都会得到

error TS2304: Build:Cannot find name 'moment'.
在我的tsconfig中,我已经将“矩”添加到类型列表中(该列表包含并适用于angularjs),并尝试将“node_modules/moment/moment.d.ts”添加到我的includes中,但都不起作用

打开日志记录后,我可以看到正在加载力矩类型定义的类型:

======== Module name 'moment' was successfully resolved to 'C:/blah/node_modules/moment/moment.d.ts'. ========
力矩定义的顶部有两个全局函数和一个命名空间:

declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, strict?: boolean): moment.Moment;
declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, language?: string, strict?: boolean): moment.Moment;

declare namespace moment {
...
我需要用什么特殊的方法来访问这些吗