feilongproject / KazuhaBot

YunZai机器人的qq频道实现
GNU Affero General Public License v3.0
17 stars 4 forks source link

src/init.ts:1:42 - error TS2724: '"qq-guild-bot"' has no exported member named 'OpenAPI'. Did you mean 'IOpenAPI'? #2

Closed TimeRainStarSky closed 2 years ago

TimeRainStarSky commented 2 years ago
/root/TRSS_Yunzai/Kazuha/node_modules/.pnpm/ts-node@10.9.1_ksn4eycaeggbrckn3ykh37hwf4/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
src/init.ts:1:42 - error TS2724: '"qq-guild-bot"' has no exported member named 'OpenAPI'. Did you mean 'IOpenAPI'?

1 import { createOpenAPI, createWebsocket, OpenAPI } from 'qq-guild-bot';
                                           ~~~~~~~
src/init.ts:91:14 - error TS7006: Parameter 'err' implicitly has an 'any' type.

91     }).catch(err => {
                ~~~

    at createTSError (/root/TRSS_Yunzai/Kazuha/node_modules/.pnpm/ts-node@10.9.1_ksn4eycaeggbrckn3ykh37hwf4/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/root/TRSS_Yunzai/Kazuha/node_modules/.pnpm/ts-node@10.9.1_ksn4eycaeggbrckn3ykh37hwf4/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/root/TRSS_Yunzai/Kazuha/node_modules/.pnpm/ts-node@10.9.1_ksn4eycaeggbrckn3ykh37hwf4/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/root/TRSS_Yunzai/Kazuha/node_modules/.pnpm/ts-node@10.9.1_ksn4eycaeggbrckn3ykh37hwf4/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/root/TRSS_Yunzai/Kazuha/node_modules/.pnpm/ts-node@10.9.1_ksn4eycaeggbrckn3ykh37hwf4/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
    at Object.require.extensions.<computed> [as .ts] (/root/TRSS_Yunzai/Kazuha/node_modules/.pnpm/ts-node@10.9.1_ksn4eycaeggbrckn3ykh37hwf4/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:997:32)
    at Function.Module._load (node:internal/modules/cjs/loader:838:12)
    at Module.require (node:internal/modules/cjs/loader:1021:19) {
  diagnosticCodes: [ 2724, 7006 ]
}
TimeRainStarSky commented 2 years ago

使用pnpm,已安装的包:

Legend: production dependency, optional only, dev only

kazuha_bot@1.0.0 /root/TRSS_Yunzai/Kazuha

dependencies:
art-template 4.13.2  md5 2.3.0            node-schedule 2.1.0  qq-guild-bot 2.9.5   yaml 2.1.1
lodash 4.17.21       moment 2.29.4        nodemon 2.0.20       redis 4.3.1
log4js 6.6.1         node-fetch 2.6.7     puppeteer 15.5.0     typescript 4.8.4

devDependencies:
@types/lodash 4.14.185
@types/md5 2.3.2
@types/node 17.0.45
@types/node-fetch 2.6.2
@types/node-schedule 2.1.0
@types/ws 8.5.3
ts-node 10.9.1
feilongproject commented 2 years ago

问题已在最新版修复。 原因:官方sdk有未导出的类型定义,原来方案是直接把模块里面的.d.ts更改,但是无法直接在其他地方使用,现在复制了一份到src里面并做了修改