core / type

NonNullSignalValue

A utility type that removes `null` and `undefined` from signal realm types.

Source: src/_core/types.ts

A utility type that removes null and undefined from signal realm types.

This is similar to TypeScript's NonNullable but handles signal types specifically.

Signature

export type NonNullSignalValue<S> = S extends null | undefined
  ? never
  : S extends SourceSignal<infer SS | null | undefined>
  ? SourceSignal<SS>
  : S extends DerivedSignal<infer DS | null | undefined>
  ? DerivedSignal<DS>
  : S extends NonSignal<infer NS | null | undefined>
  ? NonSignal<NS>
  : S;

Type Parameters

  • The type to make non-null