note

共 1130字,需浏览 3分钟

 ·

2023-07-11 01:44


bbcbae411e9d9b2be8ce85b0c3b45cbf.webp606ce7b73cfbc2d8a813062aad3661f3.webp

点击上方蓝字关注我们


在appt.ts中的globalData中加了属性,编译就出错?
08f6ebee6f9c6bc43a28415d0a6d318d.webp







 miniprogram/app.ts:4:5 - error TS2322: Type '{ phone: null; }' is not assignable to type '{ userInfo?: UserInfo | undefined; }'.
  Object literal may only specify known properties, and 'phone' does not exist in type '{ userInfo?: UserInfo | undefined; }'.
4     phone:null,
      ~~~~~~~~~~
  typings/index.d.ts:4:3
    4   globalData: {
        ~~~~~~~~~~
    The expected type comes from property 'globalData' which is declared here on type 'Options<IAppOption>'
Found 1 error.

VM3396:1 npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! miniprogram-ts-quickstart@1.0.0 tsc: `node ./node_modules/typescript/lib/tsc.js`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the miniprogram-ts-quickstart@1.0.0 tsc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.



解决办法如下


157d9e85471679a94a1c6b0aa8cc6792.webp




72397088d2aca74b847d236947b07aee.webp







f0b4400196ae1680c95c512ffb310846.webp












扫描二维码获取


更多精彩


麒玖网络











浏览 79
点赞
评论
收藏
分享

手机扫一扫分享

分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

分享
举报