We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
微信小程序
小程序基础库: 2.20 使用框架: React
PS:这是3.3.14版本!!! 直接ts使用 Taro.getEnv() === Taro.ENV_TYPE.WEAPP 时报错
不报错
实际是报错了
Taro CLI 3.3.14 environment info: System: OS: macOS 10.15.7 Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.17.5 - /usr/local/bin/node Yarn: 1.22.4 - ~/.yarn/bin/yarn npm: 7.21.1 - /usr/local/bin/npm npmGlobalPackages: typescript: 3.8.3
The text was updated successfully, but these errors were encountered:
看来类型改得有问题,我们看看的
Sorry, something went wrong.
和枚举没有关系,改版后的 Taro 类型并不会挂载任何实体类,所以 enum 类型无法直接引用。针对该问题,将在下一个版本修复,可参考以下写法:
if (Taro.getEnv() === TaroGeneral.ENV_TYPE.WEAPP) { // TODO }
fix(types): 优化类型实体写法 fix #10652
aca8463
181d5a1
4456390
feat(types): 补齐 env 导出对象类型 #10652
f05ee67
5a1665e
TaroGeneral
TaroGeneral 在哪导入?
ZakaryCode
Successfully merging a pull request may close this issue.
相关平台
微信小程序
小程序基础库: 2.20
使用框架: React
复现步骤
PS:这是3.3.14版本!!!
直接ts使用 Taro.getEnv() === Taro.ENV_TYPE.WEAPP 时报错
期望结果
不报错
实际结果
实际是报错了
环境信息
The text was updated successfully, but these errors were encountered: