Skip to content

Tighten up typing for RigidBodyComponent#type#8292

Merged
willeastcott merged 1 commit intomainfrom
rigidbody-type
Dec 21, 2025
Merged

Tighten up typing for RigidBodyComponent#type#8292
willeastcott merged 1 commit intomainfrom
rigidbody-type

Conversation

@willeastcott
Copy link
Contributor

@willeastcott willeastcott commented Dec 20, 2025

This pull request improves type safety and documentation for the type property in the RigidBodyComponent class by specifying a more precise type annotation. The changes clarify that the type property can only be one of BODYTYPE_DYNAMIC, BODYTYPE_KINEMATIC, or BODYTYPE_STATIC, rather than a generic string.

Type annotation improvements for RigidBodyComponent.type:

  • Updated the private _type property declaration to specify its type as BODYTYPE_DYNAMIC|BODYTYPE_KINEMATIC|BODYTYPE_STATIC instead of a generic type.
  • Updated the setter and getter JSDoc comments for type to use the more precise type annotation, improving code clarity and tooling support. [1] [2]

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances type safety for the RigidBodyComponent class by replacing generic type annotations with precise union types for the type property. The changes specify that the property can only accept one of three specific body type constants (BODYTYPE_DYNAMIC, BODYTYPE_KINEMATIC, or BODYTYPE_STATIC), improving code clarity and providing better tooling support for developers.

Key changes:

  • Updated the private _type field's JSDoc type annotation from implicit to explicit union type
  • Updated the type setter's JSDoc annotation from generic string to the specific union type
  • Updated the type getter's JSDoc annotation from generic string to the specific union type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@willeastcott willeastcott merged commit 19f245b into main Dec 21, 2025
13 checks passed
@willeastcott willeastcott deleted the rigidbody-type branch December 21, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: physics Physics related issue enhancement Request for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants