Use `@readonly` tag a lot more

未关闭
#7,299 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
50/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
javascript

调研方向

首先定位 Phaser 的 typing 文件,并检查 issue 中提到的 Game 和 Scene 系统对象的声明。确定预期不应被覆盖的属性,然后通过类型检查验证赋值会被拒绝,同时相关声明始终使用 readonly。

由索引模型根据 Issue 内容生成。

描述

Currently, while Phaser ostensibly has many properties that claim to "break things" if overwritten, its typing file still allows you to overwrite said properties at your leisure.

While legitimate use cases for overriding them do exist (ex: wrappers), I'd argue people able to pull that off successfully are knowledgeable enough to know about type assertions.

We should make these readonly to stop users from overwriting them and breaking their games.

I will not attempt to list every single property that should be made readonly in this manner, but notable ones include most of the Game/Scene systems objects.

主要语言
JavaScript
星标
40.7k
派生
7.2k
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

phaserjs/phaser 的其他 Issue

查看 phaserjs/phaser 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。