@rbxts/planck 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ declare class Scheduler<T extends unknown[]> {
17
17
  insertBefore(dependent: Pipeline, before: Phase): Scheduler<T>
18
18
  insertAfter(phase: Phase, after: Phase | Pipeline): Scheduler<T>
19
19
  insertAfter(pipeline: Pipeline, after: Phase | Pipeline): Scheduler<T>
20
- insert(dependent: Phase | Pipeline, instance: EventInstance | EventLike, event?: string | EventLike): Scheduler<T>
20
+ insert(dependent: Phase | Pipeline, instance: EventInstance, event?: string): Scheduler<T>
21
21
  insert(dependent: Phase | Pipeline): Scheduler<T>
22
22
  runAll(): Scheduler<T>
23
23
  run(dependent: System<T> | Phase | Pipeline): Scheduler<T>
@@ -7,7 +7,7 @@ declare const timePassed: (time: number) => Condition;
7
7
  declare const exported: {
8
8
  timePassed: (time: number) => Condition;
9
9
  runOnce: () => Condition;
10
- onEvent: <T extends unknown[]>(instance: EventInstance | EventLike, event?: string | EventLike) => LuaTuple<[Condition, IterableFunction<T>, () => void]>;
10
+ onEvent: <T extends unknown[]>(instance: EventInstance<T>, event?: string) => LuaTuple<[Condition, IterableFunction<T>, () => void]>;
11
11
  isNot: (condition: Condition) => Condition;
12
12
  cleanupCondition: (condition: Condition) => void
13
13
  }
package/out/types.d.ts CHANGED
@@ -77,14 +77,17 @@ export interface SystemTable<T extends unknown[]> {
77
77
 
78
78
  export type System<T extends unknown[]> = SystemFn<T> | SystemTable<T>;
79
79
 
80
- export interface EventLike {
81
- connect(callback: (...args: unknown[]) => void): void;
82
- Connect(callback: (...args: unknown[]) => void): void;
83
- on(callback: (...args: unknown[]) => void): void;
84
- On(callback: (...args: unknown[]) => void): void;
80
+ export type EventLike<T extends unknown[] = unknown[]> = {
81
+ connect(callback: (...args: T) => void): void;
82
+ } | {
83
+ Connect(callback: (...args: T) => void): void;
84
+ } | {
85
+ on(callback: (...args: T) => void): void;
86
+ } | {
87
+ On(callback: (...args: T) => void): void;
85
88
  }
86
89
 
87
- export type EventInstance = Instance | EventLike | RBXScriptSignal;
90
+ export type EventInstance<T extends unknown[] = unknown[]> = Instance | EventLike<T> | RBXScriptSignal;
88
91
  export type Disconnectable = RBXScriptConnection | { Disconnect(): void } | { disconnect(): void } | { Destroy(): void } | { destroy(): void; }
89
92
  export type ConnectFn = (callback: (...args: unknown[]) => void) => Disconnectable;
90
93
 
@@ -94,9 +97,9 @@ export interface Utils {
94
97
  getSystemName: <T extends unknown[]>(system: SystemFn<T>) => string
95
98
  isPhase: (phase: Phase) => Phase | undefined
96
99
  isPipeline: (pipeline: Pipeline) => Pipeline | undefined
97
- getEventIdentifier: (instance: EventInstance, event?: EventLike) => string
98
- isValidEvent: (instance: EventInstance, event: EventLike) => boolean
99
- getConnectedFunction: (instance: EventInstance | EventLike, event: string | EventLike) => ConnectFn | undefined
100
+ getEventIdentifier: <T extends unknown[]>(instance: EventInstance<T>, event?: string) => string
101
+ isValidEvent: <T extends unknown[]>(instance: EventInstance<T>, event?: string) => boolean
102
+ getConnectedFunction: <T extends unknown[]>(instance: EventInstance<T>, event?: string) => ConnectFn | undefined
100
103
  disconnectEvent: (disconectable: Disconnectable) => void
101
104
  }
102
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/planck",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "An agnostic scheduler for ECS",
5
5
  "main": "out/init.lua",
6
6
  "repository": {