Subscribe on changes!

Type '{ 'min-width': string; }' is not assignable to type 'StyleValue | undefined'. (Typescript)

avatar
Sep 10th 2021

Version

3.2.11

Reproduction link

sfc.vuejs.org/

Steps to reproduce

Set style using attribute binding: :style="{ 'min-width': cellWidth }" cellWidth is a string.

What is expected?

No error.

What is actually happening?

Error: Type '{ 'min-width': string; }' is not assignable to type 'StyleValue | undefined'. Object literal may only specify known properties, and ''min-width'' does not exist in type 'CSSProperties | StyleValue[]'.


I noticed that in the interface StandardLonghandProperties<TLength = string | 0> "min-width" is not defined, but in StandardLonghandPropertiesHyphen<TLength = string | 0> it is. Maybe StyleValue should extend the interface CSS.PropertiesHyphen<TLength = string | 0>

avatar
Sep 10th 2021

cc @johnsoncodehk I suppose

avatar
Dec 11th 2021

I am running into a similar issue with custom css properties, I believe this is related.

image

avatar
Oct 20th 2022

I am running into a similar issue with custom css properties, I believe this is related.

image

Also running into this problem. Can't declare/manipulate CSS variables with an attribute binding.