Open sathishlxg opened 3 years ago
Good idea! 👌 Thanks
Would you recommend libraries that use csstype
to work around this until the assigned milestone comes around? Could FontWeight
be changed to take arbitrary string
s in the meantime?
I was curious if anybody has a workaround in terms of declaration merging.
I ended up with:
import type * as CSS from 'csstype';
declare type LiteralUnion<T extends TPrimitive, TPrimitive = string> = T | (TPrimitive & {});
declare module 'csstype' {
interface StandardLonghandProperties<TLength = LiteralUnion<string> | 0, TTime = LiteralUnion<string>>
extends CSS.StandardLonghandProperties<TLength, TTime> {
[propertyName: string]: `var(--${string})`;
}
}
but it's not working :(
Currently CSS properties do not accept
var function
to inject values from custom properties. As a workaround we are using thetemplate literal type
and create new type. I'm aware of the workaround for type error but can this be supported natively.