-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
求求你们加强对TS的支持吧 #3009
Comments
隔壁taro对ts支持就好太多了 去偷点Types过来呀 |
还有 |
唉,vue和uni-app对ts支持太糟糕了,到了vue3也还是有痛点 |
😕 可是 request 返回的就是 task 阿 |
2023年了,现在版本的 uni-app 还是没有对 types 里,原先的回调函数进行重载,返回 promise 类型,依旧还是一个大大的 void 导致: const [err, res] = await uni.showModal 这种全部报错 |
关于api 的 Promise 化类型提示。除 |
我升级到了 在 Vue3 中,处理 API Promise 化 调用结果的方式不同于 Vue2。更多 Vue3 中,调用成功会进入 then 方法,调用失败会进入 catch 方法
vue2 项目:vue3 项目:是不是应该给这个包打个 tag 来区别 vue2 还是 vue3 的 dts ? @dcloudio/uvm另外其实我每次通过 npx @dcloudio/uvm [alpha] 升级包的时候 总是会降低 另外我经常出来让我安装新版本 npx @dcloudio/uvm 的提示,结果执行之后,发现没有那个版本执行失败 是不是发布之后,包没有同步到 npmmirror 上呀? |
@sonofmagic 关于 vue2 可以参考文档 处理,后续也会发布 vue2 的 api promise 处理 |
希望官方对社区关注多一些,跟进社区诉求快一些。 附带目前自己的解决方案 @uni-helper/uni-promises 和 @uni-helper/uni-use,希望有所帮助。 |
@dcloudio/[email protected] 已发布:
|
使用ts定义request的返回值类型还是会有不准确的问题啊 |
具体讲一下 |
await uni.request({ |
你使用的 @dcloudio/types 是什么版本?如果没有传 success 返回应该是 Promise |
"@dcloudio/types": "^3.3.3",已经是最新版本的。当然没有传success这类参数的,ts自动推断的类型是RequestTask |
持续关注该问题。👀 |
将附件中的 js 文件放到项目根目录,然后在 import App from './App'
import Vue from 'vue'
import './uni.promisify.adaptor' // Look here
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount() |
|
在 hx 中用的啊,那升级 hx 到 3.8.2 试试看 |
哈哈,那算了,等正式版再升级, |
新功能描述
很多api的ts支持真的好差啊 虽然说vue3比vue2时候好了一些吧 但还是好差
现状及问题
![image](https://user-images.githubusercontent.com/24762616/142722512-065892eb-4403-420f-a6a2-be256b9f886c.png)
![image](https://user-images.githubusercontent.com/24762616/142722530-dc6a7902-f15d-4375-a44f-c356e898a9de.png)
文档注释是这样的
request请求也不支持promise
尝试方案
官网上都写了对promise的支持 结果ts不支持
真的对我们写ts的人来说好心累
补充信息
[其它你认为有参考价值的信息]
The text was updated successfully, but these errors were encountered: