Skip to content

Commit b3083ad

Browse files
authored
Fix type definition for MenuItem when no as attribute (#426)
Not having as attribute defined ending into TT not defined and probably allow any props as result. I added as default the ComponentType, which looks making duplicates but working well. I deleted the second line which then become useless Closes issue #421
1 parent c6d9608 commit b3083ad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/menu/type-helpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ interface ForwardRefFunction<ComponentType extends As, ComponentProps = {}> {
7474
}
7575

7676
export interface ForwardRefComponentWithAs<ComponentType extends As, ComponentProps> {
77-
<TT extends As>(props: PropsWithAs<TT, ComponentProps>): React.ReactElement | null
78-
(props: PropsWithAs<ComponentType, ComponentProps>): React.ReactElement | null
77+
<TT extends As = ComponentType>(
78+
props: PropsWithAs<TT, ComponentProps>,
79+
): React.ReactElement | null
7980
readonly $$typeof: symbol
8081
defaultProps?: Partial<PropsWithAs<ComponentType, ComponentProps>>
8182
propTypes?: React.WeakValidationMap<PropsWithAs<ComponentType, ComponentProps>>

0 commit comments

Comments
 (0)