Is your feature request related to a problem? Please describe.
Hi, i'm trying to create a simplistic styled method that create SolidJS components, under the hood it use the css method from @stitches/core.
But in order to get a proper typescript support, meaning autocompletion of variants in the object passed to my styled method i need the type of the ...composers param from the cssmethod.
Describe the solution you'd like
Export the type of the ...composers param from the cssmethod.
Maybe something like this :
export type CSSComposer<
Composers extends (string | Util.Function | { [name: string]: unknown })[],
CSS = CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
> = {
[K in keyof Composers]: Composers[K] extends string | Util.Function // Strings and Functions can be skipped over
? Composers[K]
: RemoveIndex<CSS> & {
/** The **variants** property lets you set a subclass of styles based on a key-value pair.
*
* [Read Documentation](https://stitches.dev/docs/variants)
*/
variants?: {
[Name in string]: {
[Pair in number | string]: CSS;
};
};
/** The **compoundVariants** property lets you to set a subclass of styles based on a combination of active variants.
*
* [Read Documentation](https://stitches.dev/docs/variants#compound-variants)
*/
compoundVariants?: (("variants" extends keyof Composers[K]
? {
[Name in keyof Composers[K]["variants"]]?:
| Util.Widen<keyof Composers[K]["variants"][Name]>
| Util.String;
}
: Util.WideObject) & {
css: CSS;
})[];
/** The **defaultVariants** property allows you to predefine the active key-value pairs of variants.
*
* [Read Documentation](https://stitches.dev/docs/variants#default-variants)
*/
defaultVariants?: "variants" extends keyof Composers[K]
? {
[Name in keyof Composers[K]["variants"]]?:
| Util.Widen<keyof Composers[K]["variants"][Name]>
| Util.String;
}
: Util.WideObject;
} & CSS & {
[K2 in keyof Composers[K]]: K2 extends "compoundVariants" | "defaultVariants" | "variants"
? unknown
: K2 extends keyof CSS
? CSS[K2]
: unknown;
};
};
Describe alternatives you've considered
Actually i've copy pasted the type declaration of the ...composers param from the stitches source code into my code which is not great and will probably break if the stitches api changes in the futur.
Is your feature request related to a problem? Please describe. Hi, i'm trying to create a simplistic
styled
method that create SolidJS components, under the hood it use thecss
method from@stitches/core
. But in order to get a proper typescript support, meaning autocompletion of variants in the object passed to mystyled
method i need the type of the...composers
param from thecss
method.Describe the solution you'd like Export the type of the
...composers
param from thecss
method. Maybe something like this :Describe alternatives you've considered Actually i've copy pasted the type declaration of the
...composers
param from the stitches source code into my code which is not great and will probably break if the stitches api changes in the futur.