Skip to content

fix: make omitted component keys optional in world.without#321

Closed
fuleinist wants to merge 1 commit into
hmans:mainfrom
fuleinist:fix/without-optional-components
Closed

fix: make omitted component keys optional in world.without#321
fuleinist wants to merge 1 commit into
hmans:mainfrom
fuleinist:fix/without-optional-components

Conversation

@fuleinist
Copy link
Copy Markdown

Fixes #320.

The Without<E, P> type was using plain Omit<E, P>, which removes the specified component keys entirely from the entity type. This makes it impossible to re-add those components within a query loop.

This change makes omitted component keys optional instead: Omit<E, P> & Partial<Pick<E, P>>.

Before: TypeScript would error if you tried to add back a component that was removed via .without() inside a query loop.
After: The omitted keys become undefined (optional), allowing re-addition without type errors.

Tests pass (76 tests across 5 suites).

Issue hmans#320: The Without type now uses Omit<E, P> & Partial<Pick<E, P>> instead of plain Omit<E, P>, making omitted component keys optional so they can be re-added within query loops.
@codesandbox
Copy link
Copy Markdown

codesandbox Bot commented Apr 21, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 21, 2026

⚠️ No Changeset found

Latest commit: 80e1561

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@fuleinist
Copy link
Copy Markdown
Author

Stale PR (no maintainer activity for 4+ weeks). Feel free to reopen if still relevant.

@fuleinist fuleinist closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

world.without: make component keys optional instead of omitting them

1 participant