diff --git a/packages/solid/src/render/flow.ts b/packages/solid/src/render/flow.ts index 3ae42b9d5..b1a64d3fb 100644 --- a/packages/solid/src/render/flow.ts +++ b/packages/solid/src/render/flow.ts @@ -26,11 +26,11 @@ import type { JSX } from "../jsx.js"; * * @description https://www.solidjs.com/docs/latest/api#%3Cfor%3E */ -export function For(props: { - each: readonly T[] | undefined | null | false; +export function For(props: { + each: T | undefined | null | false; fallback?: JSX.Element; - children: (item: T, index: Accessor) => U; -}) { + children: (item: T[number], index: Accessor) => U; +}): Accessor { const fallback = "fallback" in props && { fallback: () => props.fallback }; return "_SOLID_DEV_" ? createMemo( @@ -54,11 +54,11 @@ export function For(props: { * * @description https://www.solidjs.com/docs/latest/api#%3Cindex%3E */ -export function Index(props: { - each: readonly T[] | undefined | null | false; +export function Index(props: { + each: T | undefined | null | false; fallback?: JSX.Element; - children: (item: Accessor, index: number) => U; -}) { + children: (item: Accessor, index: number) => U; +}): Accessor { const fallback = "fallback" in props && { fallback: () => props.fallback }; return "_SOLID_DEV_" ? createMemo(