Skip to content

Commit da11743

Browse files
committed
wip
1 parent e802e85 commit da11743

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/signals/signals-runtime/src/shared/shared-types.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,29 @@ export type SignalOfType<
88
> = AllSignals & { type: SignalType }
99

1010
export interface ISignalsRuntime<Signal extends BaseSignal> {
11+
/**
12+
* Finds a signal of a specific type from a given signal.
13+
*
14+
* @template SignalType - The type of the signal to find.
15+
* @param fromSignal - The signal to search from.
16+
* @param signalType - The type of the signal to find.
17+
* @param predicate - Optional predicate function to filter the signals.
18+
* @returns The found signal of the specified type, or undefined if not found.
19+
*/
1120
find: <SignalType extends Signal['type']>(
1221
fromSignal: Signal,
1322
signalType: SignalType,
1423
predicate?: (signal: SignalOfType<Signal, SignalType>) => boolean
1524
) => SignalOfType<Signal, SignalType> | undefined
25+
26+
/**
27+
* Filters signals of a specific type from a given signal.
28+
* @template SignalType - The type of the signals to filter.
29+
* @param fromSignal - The signal to search from.
30+
* @param signalType - The type of the signals to filter.
31+
* @param predicate - Optional predicate function to filter the signals.
32+
* @returns An array of signals of the specified type.
33+
*/
1634
filter: <SignalType extends Signal['type']>(
1735
fromSignal: Signal,
1836
signalType: SignalType,

0 commit comments

Comments
 (0)