Skip to content

Commit

Permalink
fix(unroll): unroll logic was wrong, fixed that
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDoge committed Nov 19, 2024
1 parent 06f88ee commit f7be813
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion project/app/src/shared/utils/signals/unroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { computed, Signal } from "@purifyjs/core";
export type SignalUnroll<T> = T extends Signal<infer U> ? SignalUnroll<U> : T;

export function unroll<T>(signal: T): SignalUnroll<T>;
export function unroll(value: unknown) {
export function unroll(signal: Signal<unknown>) {
return computed(() => {
let value: unknown = signal;
while (value instanceof Signal) {
value = value.val;
}
Expand Down

0 comments on commit f7be813

Please sign in to comment.