Utilização

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>;

Declaração do tipo

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

Tipo

ts
T extends false | "" | 0 | 0n ? never : T
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.