将 R (ramda) 导入 typescript .ts 文件

import R (ramda) into typescript .ts file

我正在尝试按如下方式使用 Ramda.js

/// <reference path="../../../node_modules/@types/ramda/index.d.ts" />
module App {
    var settab = R.once((element) => current(element));  
    function current(li: any) {
        // ...
    }    
}

I get error, Cannot find name 'R'

ramda/index.d.ts文件为例,声明(略)如下:

declare var R: R.Static;    
declare namespace R {
    type Ord = number | string | boolean;
    interface Static {
        // .........
    }
}

export = R;

您必须使用 import 语句导入它:

import * as R from "ramda";

此外,您不必再使用 /// <reference />,只需使用 npm install --save @types/ramda