Skip to content
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

宽松模式需要进行补充与修改错误 #2733

Closed
smallmain opened this issue Aug 5, 2023 · 0 comments
Closed

宽松模式需要进行补充与修改错误 #2733

smallmain opened this issue Aug 5, 2023 · 0 comments
Assignees

Comments

@smallmain
Copy link

错误:

升级后项目脚本在 VS Code 打开时,绑定组件定义等操作出现报红现象
Cocos Creator 3.x 开启了 TypeScript 的严格模式,会对代码进行更严格的审查,排除开发过程中可能会出现的因为疏忽而导致的问题。

如果不想使用严格模式,可以在 Creator 顶部菜单栏的 项目 -> 项目设置 -> 脚本 中勾选 启用宽松模式。需要提醒的是,我们并不鼓励关闭严格模式,因为严格空值检查能够减少代码运行时的一些低级报错。

关于严格模式下的书写规范,可以参照官方案例 快上车 3D([GitHub](https://github.com/cocos/cocos-tutorial-taxi-game) | [Gitee](https://gitee.com/mirrors_cocos-creator/tutorial-taxi-game))。

需补充:

启用宽松模式:启用宽松模式进行脚本编译。

整个文档中只有这一句话描述宽松模式。
详见 https://forum.cocos.org/t/topic/149932/528?u=smallmain

@PPpro PPpro self-assigned this Aug 17, 2023
@minggo minggo assigned dumganhar and unassigned PPpro Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

4 participants