Skip to content

Commit

Permalink
[Tabs] Fix ref type (mui#38717)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeshanTamboli authored and mnajdova committed Sep 8, 2023
1 parent 23348ba commit 8750cfb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/mui-material/src/Tabs/Tabs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { SxProps } from '@mui/system';
import { SlotComponentProps } from '@mui/base';
import { OverridableStringUnion } from '@mui/types';
import { Theme } from '../styles';
import ButtonBase from '../ButtonBase';
import { TabScrollButtonProps } from '../TabScrollButton';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
import { TabsClasses } from './tabsClasses';
Expand Down Expand Up @@ -176,7 +175,7 @@ export interface TabsOwnProps {

export interface TabsTypeMap<
AdditionalProps = {},
RootComponent extends React.ElementType = typeof ButtonBase,
RootComponent extends React.ElementType = 'div',
> {
props: AdditionalProps & TabsOwnProps;
defaultComponent: RootComponent;
Expand Down
8 changes: 8 additions & 0 deletions packages/mui-material/src/Tabs/Tabs.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { expectType } from '@mui/types';
import Tabs from '@mui/material/Tabs';
import SvgIcon from '@mui/material/SvgIcon';

Expand Down Expand Up @@ -50,3 +51,10 @@ function SampleIcon() {
}),
}}
/>;

// Test for ref type
<Tabs
ref={(elem) => {
expectType<HTMLDivElement | null, typeof elem>(elem);
}}
/>;

0 comments on commit 8750cfb

Please sign in to comment.