Skip to content

Commit

Permalink
standardize portal/signal 'is' checks
Browse files Browse the repository at this point in the history
  • Loading branch information
LankyMoose committed Jul 16, 2024
1 parent 20121da commit a034ac4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/lib/src/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Portal extends Component<PortalProps> {
}

static isPortal(type: unknown): type is typeof Portal {
return !!type && typeof type === "function" && portalIdentifier in type
return typeof type === "function" && portalIdentifier in type
}

render(): JSX.Element {
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/src/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class Signal<T> {
}

static isSignal(x: any): x is Signal<any> {
return x && x[SignalKey]
return typeof x === "object" && !!x && SignalKey in x
}

static subscribeNode(node: Kaioken.VNode, signal: Signal<any>) {
Expand Down

0 comments on commit a034ac4

Please sign in to comment.