【发布时间】:2018-02-11 06:41:04
【问题描述】:
我使用 nodejs 模块“ws”并安装类型typings i dt~ws
import * as WebSocket from "ws";
function add(client:WebScoket){
let cid = client.clientId;
}
我想扩展 WebSocket 属性为clientId,但我不知道怎么做。
我已经尝试在我的定义文件index.d.ts 中编写后续代码
declare module "ws" {
class WebSocket {
ip: string;
clientId: number;
project: string;
}
}
但无效
【问题讨论】:
标签: node.js typescript