【发布时间】:2014-07-01 08:57:35
【问题描述】:
我正在尝试在 NodeJS 中使用来自 typescript-collections 的 Dictionary 类:
/// <reference path="../../../scripts/collections.ts" />
var collections = require('../../../scripts/collections');
export class AsyncProcessorCommand implements interfaces.IAsyncProcessorCommand
{
public static Type = 'RabbitMon.AsyncProcessorCommand:RabbitMon';
public GetType = () => 'RabbitMon.AsyncProcessorCommand:RabbitMon';
public ID: string;
constructor(public Action: string, public Arguments?: collections.Dictionary<string, string>) {
this.ID = uuid.v4();
this.Arguments = new collections.Dictionary<string, string>();
//I've also tried the following
//this.Arguments = new collections.Dictionary<string, string>((key: string) => sha1(key));
}
}
但我在new Dictionary 上不断收到以下错误:
TypeError: undefined is not a function
有人知道这里发生了什么吗?我也非常乐意替换一个更好的工作 TS 集合库...
【问题讨论】:
标签: node.js collections typescript