Skip to content

assignment to undeclared variable in .svelte.(js|ts) gives strange error #17023

@Rich-Harris

Description

@Rich-Harris

Describe the bug

Reported here — if you have an assignment to an undeclared variable, it says you can't assign to $props.id(). Which is weird.

Most of the time this will error because modules are automatically in strict mode. But if you're assigning to something on globalThis then it should work just fine. Either way, the error is very confusing

Reproduction

https://svelte.dev/playground/c274ec44155c4dab8f9501b591a17d3c?version=5.41.3

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