Open majidsajadi opened 1 year ago
If I understood your intentions properly you can get the type of css
object returned from the createStitches
method by importing Stitches
as default and accessing css
property like this: Stitches['css']
.
Because the css
function & component prop is dynamic based on the configuration you pass to createStitches
, it can't be provided as a static import. What I've done for my project is export a type in my stitches.config.ts
:
import { CSS, createStitches } from '@stitches/react'
export const {
styled,
css,
globalCss,
keyframes,
getCssText,
theme,
createTheme,
config,
} = createStitches({ /* your config here */ })
export type CSSProp = CSS<typeof config>
Is your feature request related to a problem? Please describe. Im using React context API for exposing created stitches config to the components. I want to store
css
in context but there is no exported type.Describe the solution you'd like Export
css
andstyled
types.Describe alternatives you've considered Im currently using
typeof css
operator.