bilibili_blacklist
bilibili_blacklist copied to clipboard
本地编译报对象类型错误
报错信息如下:
src/website_apis.ts(59,29): error TS2345: Argument of type 'string | ParsedQs | string[] | ParsedQs[] | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
src/website_apis.ts(63,78): error TS2339: Property 'split' does not exist on type 'string | ParsedQs | string[] | ParsedQs[]'.
Property 'split' does not exist on type 'string[]'.
src/website_apis.ts(69,55): error TS2345: Argument of type 'string | ParsedQs | string[] | ParsedQs[]' is not assignable to parameter of type 'string | [string, number][] | { [key: string]: number | { $meta?: "textScore" | "indexKey" | undefined; }; } | { [x: string]: number | { $meta?: "textScore" | "indexKey" | undefined; } | undefined; }'.
Type 'ParsedQs' is not assignable to type 'string | [string, number][] | { [key: string]: number | { $meta?: "textScore" | "indexKey" | undefined; }; } | { [x: string]: number | { $meta?: "textScore" | "indexKey" | undefined; } | undefined; }'.
Type 'ParsedQs' is not assignable to type 'string'.
src/website_apis.ts(215,31): error TS2345: Argument of type 'string | ParsedQs | string[] | ParsedQs[] | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
看上去是新版本DefinitelyTyped修改导致的,把req.query["page"]
换成req.query.page
试试?有空的时候我会自己修改,或者欢迎你发pr。
看上去是新版本DefinitelyTyped修改导致的,把
req.query["page"]
换成req.query.page
试试?有空的时候我会自己修改,或者欢迎你发pr。
之前使用的是node的哪个版本?我先用老版本试下吧
你往前reset几个commit试试吧
你往前reset几个commit试试吧
不行,我试了很多次,直到 fa2c2b995627d12a9e819b8ac5fd2fe952b478ea 提交还是报相同的错,这已经是今年2月的提交了。 后来我reset到 ea2aba785f248e6d4a1cafe357b89bc88b4c43d3 提交,报错就变成以下信息了:
node_modules/@types/mongodb/index.d.ts(41,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/assert.d.ts(3,68): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(57,68): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(66,94): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(66,101): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(66,104): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(68,98): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(68,105): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(68,108): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(76,47): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(76,53): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(76,56): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(106,61): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(112,63): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(113,89): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(113,96): error TS1005: ',' expected.
node_modules/@types/node/assert.d.ts(113,99): error TS1005: ',' expected.
node_modules/@types/node/assert.d.ts(114,38): error TS1005: ',' expected.
node_modules/@types/node/assert.d.ts(114,53): error TS1005: ',' expected.
node_modules/@types/node/assert.d.ts(114,66): error TS1109: Expression expected.
node_modules/@types/node/assert.d.ts(114,83): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(114,93): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(114,100): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(114,103): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(115,26): error TS1005: ',' expected.
node_modules/@types/node/assert.d.ts(115,32): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(115,42): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(115,48): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(115,51): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(120,1): error TS1128: Declaration or statement expected.
node_modules/@types/node/base.d.ts(10,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/base.d.ts(11,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/base.d.ts(12,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/base.d.ts(13,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.4/base.d.ts(10,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.4/base.d.ts(11,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.4/base.d.ts(12,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.4/base.d.ts(13,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(10,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(11,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(12,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(13,1): error TS1084: Invalid 'reference' directive syntax.
看上去是新版本DefinitelyTyped修改导致的,把
req.query["page"]
换成req.query.page
试试?有空的时候我会自己修改,或者欢迎你发pr。
另外我也尝试了把obj["key"]形式批量替换成obj.key形式,报错依然没变