diff --git a/.changeset/plenty-bikes-fold.md b/.changeset/plenty-bikes-fold.md new file mode 100644 index 000000000..80a997036 --- /dev/null +++ b/.changeset/plenty-bikes-fold.md @@ -0,0 +1,5 @@ +--- +"@preact/signals": patch +--- + +Narrow types for Show utility, the callback is truthy by design diff --git a/packages/preact/utils/src/index.ts b/packages/preact/utils/src/index.ts index 98478882d..785d447b9 100644 --- a/packages/preact/utils/src/index.ts +++ b/packages/preact/utils/src/index.ts @@ -6,7 +6,7 @@ import { useMemo } from "preact/hooks"; interface ShowProps { when: Signal | ReadonlySignal; fallback?: JSX.Element; - children: JSX.Element | ((value: T) => JSX.Element); + children: JSX.Element | ((value: NonNullable) => JSX.Element); } export function Show(props: ShowProps): JSX.Element | null {