2
我试图使用Ramda.js如下:进口R(ramda)为打字稿的.ts文件
/// <reference path="../../../node_modules/@types/ramda/index.d.ts" />
module App {
var settab = R.once((element) => current(element));
function current(li: any) {
// ...
}
}
我得到错误,找不到名称 'R'
在ramda/index.d.ts
文件的情况下,声明(具体省略)如下:
declare var R: R.Static;
declare namespace R {
type Ord = number | string | boolean;
interface Static {
// .........
}
}
export = R;
当'--module'为'none'时,出现错误'无法使用导入,导出或模块增量。哪个模块选项会使我与我以前使用过的'/// '最接近? –
Jim
您可以在'tsconfig.json'中将'compilerOptions.module'设置为'commonjs'并使用'import'statements。 – Saravana