@@ -46,8 +46,9 @@ type Caps =
4646 | 'Y'
4747 | 'Z' ;
4848
49- export interface BasePropsWithoutChildren
49+ export interface BasePropsWithoutChildren < K extends TagName = TagName >
5050 extends Pick < AllHTMLAttributes < HTMLElement > , 'className' | 'role' | 'id' > {
51+ as ?: K ;
5152 /** QA ID for e2e testing. An alias for `data-qa` attribute. */
5253 qa ?: string ;
5354 /** QA value for e2e testing. An alias for `data-qaval` attribute. */
@@ -80,13 +81,13 @@ export interface BasePropsWithoutChildren
8081 theme ?: 'default' | 'danger' | 'special' | ( string & { } ) ;
8182}
8283
83- export interface BaseProps < K extends keyof HTMLElementTagNameMap = 'div' >
84+ export interface BaseProps < K extends TagName = TagName >
8485 extends AriaLabelingProps ,
85- BasePropsWithoutChildren ,
86+ BasePropsWithoutChildren < K > ,
8687 Pick < AllHTMLAttributes < HTMLElementTagNameMap [ K ] > , 'children' > { }
8788
88- export interface AllBaseProps < K extends keyof HTMLElementTagNameMap = 'div' >
89- extends BaseProps ,
89+ export interface AllBaseProps < K extends TagName = TagName >
90+ extends BaseProps < K > ,
9091 Omit <
9192 AllHTMLAttributes < HTMLElementTagNameMap [ K ] > ,
9293 | 'style'
@@ -99,9 +100,9 @@ export interface AllBaseProps<K extends keyof HTMLElementTagNameMap = 'div'>
99100 | 'width'
100101 | 'content'
101102 | 'translate'
102- > {
103- as ?: K ;
104- }
103+ | 'as'
104+ | 'form'
105+ > { }
105106
106107export type BaseStyleProps = Pick < Styles , ( typeof BASE_STYLES ) [ number ] > ;
107108export type PositionStyleProps = Pick < Styles , ( typeof POSITION_STYLES ) [ number ] > ;
@@ -131,8 +132,3 @@ export interface Props {
131132}
132133
133134export type TagName = keyof HTMLElementTagNameMap ;
134-
135- export interface TagNameProps {
136- /** The tag name you want to use for the element */
137- as ?: TagName ;
138- }
0 commit comments