【发布时间】:2019-07-01 09:33:48
【问题描述】:
尝试只学习 ngx-socket-io 教程,但我不断收到错误 Property msg doesn't exist on type {}。
https://www.npmjs.com/package/ngx-socket-io
我已经正确安装了所有东西,并且在 AppModule.ts 中有我需要的所有东西,我还导入了地图和套接字。
我的 ChatService.ts
constructor(private socket: Socket){}
sendMessage(msg: String){
this.socket.emit("message", msg);
}
getMessage() {
return this.socket.fromEvent("message").pipe(map(data => data.msg));
}
【问题讨论】: