Skip to content

style directive gives type error for nullish values #1423

@gtm-nayan

Description

@gtm-nayan

Describe the bug
Null values can be used in style directives to remove styles and undefined can be used to leave previously applied styles without overriding. However, style directive values are currently typed as 'String | Number' which gives a type error when attempting to use nullish values.

To Reproduce
Put a possibly nullish value in a style directive by itself.

For example a code snippet that is treated in a way you don't expect.

<svg
    style:float={null}
/>

Expected behavior
Nullish values are allowed in style directives.

Screenshots
image

System (please complete the following information):

  • OS: Windows
  • IDE: VSCode
  • Plugin/Package: svelte-language-server

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions