Skip to content

Commit

Permalink
Update Maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeGensler committed Jan 21, 2024
1 parent d6cc95f commit db6e282
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/thyseus/src/index.ts
Expand Up @@ -3,7 +3,7 @@ export { applyCommands, Commands } from './commands';
export { Tag } from './components';
export { Entity } from './entities';
export { EventReader, Events, EventWriter } from './events';
export { Query, With, Without, Or, And, MaybeModifier } from './queries';
export { Query, With, Without, Or, And, Maybe, MaybeModifier } from './queries';
export { Res, SystemRes } from './resources';
export { cloneSystem } from './systems';
export { expose, Thread, Threads } from './threads';
Expand All @@ -13,7 +13,7 @@ export { World, Schedule } from './world';
export type { EntityCommands } from './commands';
export type { Table, Class } from './components';
export type { Entities } from './entities';
export type { Filter, Maybe } from './queries';
export type { Filter } from './queries';
export type { System, SystemParameter } from './systems';
export type { StructuredCloneable } from './threads';
export type { Plugin, WorldConfig } from './world';
2 changes: 1 addition & 1 deletion packages/thyseus/src/queries/index.ts
@@ -1,3 +1,3 @@
export { Query } from './Query';
export { With, Without, Or, And, type Filter } from './filters';
export { MaybeModifier, type Maybe } from './modifiers';
export { Maybe, MaybeModifier } from './modifiers';
9 changes: 5 additions & 4 deletions packages/thyseus/src/queries/modifiers.ts
Expand Up @@ -5,11 +5,12 @@ import { World } from '../world';
* A type that may or may not be present.
*/
export type Maybe<T> = T | undefined;
export const Maybe = {
intoArgument(_: World, type: Class) {
return new MaybeModifier(type);
},
};
export class MaybeModifier {
static intoArgument(_: World, type: Class) {
return new this(type);
}

type: Class;
constructor(type: Class) {
this.type = type;
Expand Down

0 comments on commit db6e282

Please sign in to comment.