Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ts declarations #170

Merged
merged 1 commit into from
Jan 2, 2025
Merged

Update ts declarations #170

merged 1 commit into from
Jan 2, 2025

Conversation

hautajoki
Copy link
Contributor

this pr adds the following:

  • missing API methods: query.cached, world.cleanup, world.children, and world.each
  • a class for cached queries coincidentally named CachedQuery

fixes:

  • added the missing world parameters to pair_firstand pair_second
  • updated the definition of Pair from Pair<Entity<P>, Entity<O>> to Pair<P, O>. A pair can only hold entities - no reason to declare it explicitly.
  • better Id type to match pair typings:
const myFunction = (id: Id<Vector3>) => {
    // do something
}

const ent = world.entity()
const pos = world.component<Vector3>()

myFunction(pos)
myFunction(pair(pos, pos))

// this is now valid
myFunction(pair(pos, ent))
myFunction(pair(ent, pos))

@Ukendio
Copy link
Owner

Ukendio commented Jan 2, 2025

Thank you for your contribution!

@Ukendio Ukendio merged commit 489366b into Ukendio:main Jan 2, 2025
2 checks passed
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.

2 participants