Skip to content

Allow numbers in style: directive #1342

@PuruVJ

Description

@PuruVJ

Is your feature request related to a problem? Please describe.
In style: directive syntax, you can't pass a number. Svelte's VSCode extension errors out when you attempt something like style:z-index={someNumericalValue}, so you have to apply hacks like style:z-index={someNumericalValue + ''} to coerce it into a string, which looks really ugly.

Describe the solution you'd like
I recommend language-tools don't error out when value passed is a number, as that is a valid value for properties like z-index, width, height, block-*, top, bottom, inset, opacity, and many more, including all the CSS Variables style:--opacity={someNumber}.

This would work because we know JS coerces numbers into strings when needed, so svelte core itself doesn't need to be changed

Describe alternatives you've considered
Not do anything

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.feature requestNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions