https://developers.weixin.qq.com/miniprogram/dev/extended/utils/api-promise.html
有没有在Typescript环境下使用的Promise?按教程npm install后再import时报错
{
"resource": "/C:/Users/whh/WeChatProjects/miniprogram-11/miniprogram/app.ts",
"owner": "typescript",
"code": "7016",
"severity": 8,
"message": "无法找到模块“miniprogram-api-promise”的声明文件。“c:/Users/whh/WeChatProjects/miniprogram-11/node_modules/miniprogram-api-promise/src/index.js”隐式拥有 \"any\" 类型。\n Try `npm install @types/miniprogram-api-promise` if it exists or add a new declaration (.d.ts) file containing `declare module 'miniprogram-api-promise';`",
"source": "ts",
"startLineNumber": 2,
"startColumn": 41,
"endLineNumber": 2,
"endColumn": 66
}
基础库 2.10.2 开始已经原生支持 promise 式调用了,ts 定义也支持了,可以试一试
如果是为了兼容,需要用 miniprogram-api-promise 的话,可以在这个issue里跟进一下进度
明白,已解决,谢谢!