Usage

Type content rendered for a present value.

tsx
// Type content rendered for a present value.
import { Show, Text, signal, type Truthy } from 'kuito';

type User = { name: string } | null;

const user = signal<User>(null);

// The branch callback gets the user without `null`: no check needed inside.
const greet = (signedIn: Truthy<User>) => <Text>Hello, {signedIn.name}</Text>;

<Show when={user.value} fallback={<Text>Sign in</Text>}>
  {greet}
</Show>;

Type declaration

ts
export type Truthy<T> = Exclude<T, null | undefined | false | 0 | 0n | ''>;

Type

ts
T extends false | "" | 0 | 0n ? never : T
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.