mirror of
https://github.com/Ukendio/jecs.git
synced 2025-06-19 15:59:18 +00:00
Allow world.add() to accept component, add world.entity overload (#225)
* fix: allow components for world.add in typescript * fix: add overload for world.entity * build: downgrade deps to v0.6.0 * fix: world.entity accepts entity instead of number * fix: allow union undefined union to be passed in .add
This commit is contained in:
parent
c030d396af
commit
22877f3fc5
2 changed files with 4 additions and 3 deletions
3
jecs.d.ts
vendored
3
jecs.d.ts
vendored
|
@ -120,6 +120,7 @@ export class World {
|
|||
* @returns An entity (Tag) with no data.
|
||||
*/
|
||||
entity(): Tag;
|
||||
entity<T extends Entity>(id: T): InferComponent<T> extends undefined ? Tag : T;
|
||||
|
||||
/**
|
||||
* Creates a new entity in the first 256 IDs, typically used for static
|
||||
|
@ -148,7 +149,7 @@ export class World {
|
|||
* @param entity The target entity.
|
||||
* @param component The component (or tag) to add.
|
||||
*/
|
||||
add(entity: Entity, component: Id<undefined>): void;
|
||||
add<C>(entity: Entity, component: undefined extends InferComponent<C> ? C : Id<undefined>): void;
|
||||
|
||||
/**
|
||||
* Assigns a value to a component on the given entity.
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@rbxts/jecs",
|
||||
"version": "0.6.0-rc.1",
|
||||
"version": "0.6.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@rbxts/jecs",
|
||||
"version": "0.6.0-rc.1",
|
||||
"version": "0.6.0",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@rbxts/compiler-types": "^2.3.0-types.1",
|
||||
|
|
Loading…
Reference in a new issue