@@ -14,6 +14,7 @@ import {
1414import domElements , { type SupportedHTMLElements } from '@/src/constants/domElements'
1515import { type ExpressionType , generateClassName , generateComponentName , insertExpressions , injectStyle , removeStyle } from '@/src/utils'
1616import { isStyledComponent , isValidElementType , isVueComponent } from '@/src/helper'
17+ import { DefaultTheme } from './providers'
1718
1819interface IProps {
1920 as ?: PropType < SupportedHTMLElements >
@@ -27,7 +28,7 @@ export type StyledComponentType<P = any> = DefineSetupFnComponent<IProps & P, an
2728
2829type StyledFactory = < T = Record < string , any > > (
2930 styles : TemplateStringsArray ,
30- ...expressions : ( ExpressionType < T > | ExpressionType < T > [ ] ) [ ]
31+ ...expressions : ( ExpressionType < T & { theme : DefaultTheme } > | ExpressionType < T & { theme : DefaultTheme } > [ ] ) [ ]
3132) => StyledComponentType
3233type StyledComponent = StyledFactory & {
3334 attrs : < T extends Record < string , unknown > > ( attrs : T ) => StyledFactory
@@ -52,7 +53,7 @@ function baseStyled<P extends Record<string, any>>(target: string | InstanceType
5253 return styledComponent
5354 }
5455
55- function createStyledComponent < T > ( cssWithExpression : ExpressionType < T > [ ] ) : StyledComponentType {
56+ function createStyledComponent < T > ( cssWithExpression : ExpressionType < T & { theme : DefaultTheme } > [ ] ) : StyledComponentType {
5657 let type : string = target
5758 if ( isVueComponent ( target ) ) {
5859 type = 'vue-component'
@@ -80,15 +81,15 @@ function baseStyled<P extends Record<string, any>>(target: string | InstanceType
8081 theme : theme ?. value ?? { } ,
8182 ...props ,
8283 }
83- injectStyle < T > ( myAttrs . class , cssWithExpression , context )
84+ injectStyle < T & { theme : DefaultTheme } > ( myAttrs . class , cssWithExpression , context )
8485 } ,
8586 {
8687 deep : true ,
8788 } ,
8889 )
8990
9091 onMounted ( ( ) => {
91- injectStyle < T > ( myAttrs . class , cssWithExpression , context )
92+ injectStyle < T & { theme : DefaultTheme } > ( myAttrs . class , cssWithExpression , context )
9293 } )
9394
9495 onUnmounted ( ( ) => {
0 commit comments