Incorrect typing for Phaser.Types.GameObjects.Particles.RandomZoneSourceCallback
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 40.3k
- Forks
- 7.2k
- PR merge metrics
- No merged PRs in 30d
Description
Version
- Phaser Version: 3.80.1
- Operating system:
- Browser:
Description
There is a typescript error when I am trying to create RandomZone for ParticlesEmitter.
Example Test Code
const emitRect = new Phaser.Geom.Rectangle()
new Phaser.GameObjects.Particles.Zones.RandomZone(emitRect)
Error:
Argument of type 'Rectangle' is not assignable to parameter of type 'RandomZoneSource'.
Types of property 'getRandomPoint' are incompatible.
Type '(point?: O | undefined) => O' is not assignable to type 'RandomZoneSourceCallback'.
Types of parameters 'point' and 'point' are incompatible.
Type 'Vector2Like' is missing the following properties from type 'Point': type, setTo
Additional Information
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the type definitions for Phaser.GameObjects.Particles.Zones.RandomZone, RandomZoneSource, RandomZoneSourceCallback, and Geom.Rectangle, then compare the callback signatures involved in the reported error. Use the provided RandomZone example to reproduce the TypeScript failure; done means the example type-checks without the incompatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100