Skip to content

Commit

Permalink
feat: typed get
Browse files Browse the repository at this point in the history
  • Loading branch information
lajbel committed Sep 1, 2024
1 parent 7766f64 commit 0e94d73
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/game/make.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export function make<T>(comps: CompList<T> = []): GameObj<MakeType<T>> {
},

// TODO: Separate
get(t: Tag | Tag[], opts: GetOpt = {}): GameObj[] {
get<T = any>(t: Tag | Tag[], opts: GetOpt = {}): GameObj<T>[] {
let list: GameObj[] = opts.recursive
? this.children.flatMap(
function recurse(child: GameObj): GameObj[] {
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export interface KAPLAYCtx<
*
* @group Game Obj
*/
get<T>(tag: Tag | Tag[], opts?: GetOpt): GameObj<T>[];
get<T = any>(tag: Tag | Tag[], opts?: GetOpt): GameObj<T>[];
/**
* Get a list of game objects in an advanced way.
*
Expand Down Expand Up @@ -3997,7 +3997,7 @@ export interface GameObjRaw {
*
* @since v3000.0
*/
get(tag: Tag | Tag[], opts?: GetOpt): GameObj[];
get<T = any>(tag: Tag | Tag[], opts?: GetOpt): GameObj<T>[];
/**
* Get a list of all game objs with certain properties.
*
Expand Down

0 comments on commit 0e94d73

Please sign in to comment.