phaserjs / phaserjs/phaser

Use `@readonly` tag a lot more

Open
#7,299 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
40.3k
Forks
7.2k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating Phaser's typing file and reviewing the declarations for the Game and Scene system objects mentioned in the issue. Identify the properties that are intended not to be overwritten, then verify with type checks that assignments are rejected while the relevant declarations consistently use readonly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.