@@ -28,13 +28,20 @@ export interface UnstyledProps {
28
28
unstyled?: boolean | undefined
29
29
}
30
30
31
+ export interface AsProps {
32
+ /**
33
+ * The element to render as
34
+ */
35
+ as?: ElementType | undefined
36
+ }
37
+
31
38
export type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
32
39
ref?: Ref<ElementRef<T>>
33
40
}
34
41
35
42
export interface ${ componentName } <T extends ElementType, P extends Dict = {}> {
36
- (props: JsxHTMLProps<ComponentProps<T> & UnstyledProps, Assign<JsxStyleProps, P>>): JSX.Element
37
- displayName?: string
43
+ (props: JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps , Assign<JsxStyleProps, P>>): JSX.Element
44
+ displayName?: string | undefined
38
45
}
39
46
40
47
interface RecipeFn {
@@ -48,7 +55,7 @@ interface JsxFactoryOptions<TProps extends Dict> {
48
55
forwardProps?: string[]
49
56
}
50
57
51
- export type JsxRecipeProps<T extends ElementType, P extends Dict> = JsxHTMLProps<ComponentProps<T> & UnstyledProps, P>;
58
+ export type JsxRecipeProps<T extends ElementType, P extends Dict> = JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps , P>;
52
59
53
60
export type JsxElement<T extends ElementType, P extends Dict> = T extends ${ componentName } <infer A, infer B>
54
61
? ${ componentName } <A, Pretty<DistributiveUnion<P, B>>>
@@ -69,7 +76,7 @@ export type JsxElements = {
69
76
70
77
export type ${ upperName } = JsxFactory & JsxElements
71
78
72
- export type ${ typeName } <T extends ElementType> = JsxHTMLProps<ComponentProps<T> & UnstyledProps, JsxStyleProps>
79
+ export type ${ typeName } <T extends ElementType> = JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps , JsxStyleProps>
73
80
74
81
export type ${ variantName } <T extends ${ componentName } <any, any>> = T extends ${ componentName } <any, infer Props> ? Props : never
75
82
` ,
0 commit comments