TypeSrcipt模板更新添加miniprogram-api-typings编译出错。求助官方?
[图片][图片] [图片] 之前TypeSrcipt 模板里面 package.json 中dependencies 里面没有 miniprogram-api-typings。 npm install miniprogram-api-typings
之后在 tsconfig.json 中修改
typeRoots : [
"./node_modules/miniprogram-api-typings"
]
1.编译出现 错误
miniprogram/pages/auc/special/special.ts:62:3 - error TS2345: Argument of type '{ data: { curPage: number; pageSize: number; specials: never[]; session: {}; sesCode: string; loading: false; footer: false; showmask: false; loadAfresh: false; }; onLoad(options: any): void; onPullDownRefresh(): void; ... 4 more ...; handleTapLots(event: any): void; }' is not assignable to parameter of type 'Options<{ curPage: number; pageSize: number; specials: never[]; session: {}; sesCode: string; loading: boolean; footer: boolean; showmask: boolean; loadAfresh: boolean; }, {}>'.
Object literal may only specify known properties, and 'eventLoadAfresh' does not exist in type 'Options<{ curPage: number; pageSize: number; specials: never[]; session: {}; sesCode: string; loading: boolean; footer: boolean; showmask: boolean; loadAfresh: boolean; }, {}>'.
62 eventLoadAfresh() {
2.miniprogram-api-typings 文件里面也出现错误
node_modules/miniprogram-api-typings/types/wx/lib.wx.api.d.ts:15775:15 - error TS2451: Cannot redeclare block-scoped variable 'console'.
15775 declare const console: WechatMiniprogram.Console
~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:17510:13
17510 declare var console: Console;
~~~~~~~
'console' was also declared here.