Skip to content

Error compiling component in demo of the shorthand of class binding #371

Open
@Cweili

Description

@Cweili

The demo of the shorthand of class binding has "Error compiling component".

Link:

https://svelte.technology/repl?version=2.14.2&demo=bz2ba6

Error:

Computed property name 'is-selected' is invalid — must be a valid identifier such as is_selected
12:     // Because shorthand relfects the var name, you must use component.set({ "is-selected": true }) or use a computed
13:     // property like this. It might be better to avoid shorthand for class names which are not valid variable names.
14:     "is-selected": ({ isSelected }) => isSelected
        ^
15:   }
16: }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions