From f4df2bd46a4cd65188dbf3be3e8e68035017e1e6 Mon Sep 17 00:00:00 2001 From: sai chand <60743144+sai6855@users.noreply.github.com> Date: Tue, 9 May 2023 16:34:43 +0530 Subject: [PATCH] [AppBar] Fix component type (#37172) --- packages/mui-material/src/AppBar/AppBar.d.ts | 16 +++++++++------- packages/mui-material/src/AppBar/AppBar.spec.tsx | 9 ++++++++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/mui-material/src/AppBar/AppBar.d.ts b/packages/mui-material/src/AppBar/AppBar.d.ts index 2d0388405baca2..93be380f80e91b 100644 --- a/packages/mui-material/src/AppBar/AppBar.d.ts +++ b/packages/mui-material/src/AppBar/AppBar.d.ts @@ -1,16 +1,16 @@ import * as React from 'react'; import { SxProps } from '@mui/system'; -import { DistributiveOmit, OverridableStringUnion } from '@mui/types'; +import { OverridableStringUnion } from '@mui/types'; import { OverridableComponent, OverrideProps } from '@mui/material/OverridableComponent'; import { PropTypes, Theme } from '..'; -import { PaperProps } from '../Paper'; import { AppBarClasses } from './appBarClasses'; +import { ExtendPaperTypeMap } from '../Paper/Paper'; export interface AppBarPropsColorOverrides {} -export interface AppBarTypeMap

{ - props: P & - DistributiveOmit & { +export type AppBarTypeMap

= ExtendPaperTypeMap< + { + props: P & { /** * Override or extend the styles applied to the component. */ @@ -39,8 +39,10 @@ export interface AppBarTypeMap

{ */ sx?: SxProps; }; - defaultComponent: D; -} + defaultComponent: D; + }, + 'position' | 'color' | 'classes' +>; /** * diff --git a/packages/mui-material/src/AppBar/AppBar.spec.tsx b/packages/mui-material/src/AppBar/AppBar.spec.tsx index 8600ddcd018553..5cd01d7d44537a 100644 --- a/packages/mui-material/src/AppBar/AppBar.spec.tsx +++ b/packages/mui-material/src/AppBar/AppBar.spec.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import AppBar from '@mui/material/AppBar'; +import { expectType } from '@mui/types'; const CustomComponent: React.FC<{ stringProp: string; numberProp: number }> = function CustomComponent() { @@ -12,7 +13,13 @@ function AppBarTest() { - + { + expectType, typeof event>(event); + }} + /> {/* @ts-expect-error missing stringProp and numberProp */}