mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
fix TData infer issue
This commit is contained in:
parent
059a49132b
commit
15d5c44085
1 changed files with 3 additions and 2 deletions
5
jecs.d.ts
vendored
5
jecs.d.ts
vendored
|
@ -4,7 +4,7 @@
|
|||
* and cannot be used used as a component to associate any kind of data with itself.
|
||||
*/
|
||||
export type Id = number & {
|
||||
readonly __nominal_Id: unique symbol,
|
||||
readonly __nominal_Id: unique symbol;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -24,6 +24,7 @@ export type Tag = Id & {
|
|||
*/
|
||||
export type Entity<TData = unknown> = Tag & {
|
||||
readonly __nominal_Entity: unique symbol;
|
||||
readonly __type_TData: TData;
|
||||
};
|
||||
|
||||
type InferComponent<TValue> = TValue extends Entity<infer TData> ? TData : never;
|
||||
|
@ -133,7 +134,7 @@ export class World {
|
|||
* @param component Target Component
|
||||
* @param value Component Value
|
||||
*/
|
||||
set<TComponent extends Entity>(entity: Id, component: TComponent, value: InferComponent<NoInfer<TComponent>>): void;
|
||||
set<TData>(entity: Id, component: Entity<TData>, value: NoInfer<TData>): void;
|
||||
|
||||
/**
|
||||
* Removes a component from the given entity
|
||||
|
|
Loading…
Reference in a new issue