Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在ts项目中 Websocket 接口的类型声明和文档上的描述不符 #80

Open
tokisakiyuu opened this issue Feb 10, 2023 · 1 comment

Comments

@tokisakiyuu
Copy link

描述

在vscode中的截图如下:

image

当然,编译也是不过的:

> tsc

src/main.ts:13:4 - error TS2339: Property 'on' does not exist on type 'WebsocketClient'.

13 ws.on('READY', (wsdata: any) => {
      ~~

依赖

├── @types/node@18.13.0 -> ./node_modules/.pnpm/@types+node@18.13.0/node_modules/@types/node
├── axios@1.3.2 -> ./node_modules/.pnpm/axios@1.3.2/node_modules/axios
├── dotenv@16.0.3 -> ./node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv
├── qq-guild-bot@2.9.5 -> ./node_modules/.pnpm/qq-guild-bot@2.9.5/node_modules/qq-guild-bot
├── ts-node@10.9.1 -> ./node_modules/.pnpm/ts-node@10.9.1_4bewfcp2iebiwuold25d6rgcsy/node_modules/ts-node
└── typescript@4.9.5 -> ./node_modules/.pnpm/typescript@4.9.5/node_modules/typescript

环境

nodejs v16.14.0
pnpm 7.2.1

@WitchElaina
Copy link

添加这个依赖可以解决

"dependencies": {
    "@types/ws": "^8.2.0",
}

pangxiaoli added a commit to pangxiaoli/bot-node-sdk that referenced this issue Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants