Skip to content

docs: undefined and null are allowed in the each block #17337

@hyunbinseo

Description

@hyunbinseo

Describe the bug

Svelte each block now supports undefined and null.

The docs should be updated to match this behavior.

Current explanation is incorrect:

in other words, anything that can be used with Array.from.

Array.from(undefined); // Uncaught TypeError: can't access property Symbol.iterator, items is undefined
Array.from(null); // Uncaught TypeError

Stating this in the docs will avoid LLMs from writing ?? [] inside the each loop.

Reproduction

Logs

System Info

-

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions