Skip to content

Commit

Permalink
[material-ui][Select] Fix muiName property TypeScript error (#41726)
Browse files Browse the repository at this point in the history
Co-authored-by: ZeeshanTamboli <zeeshan.tamboli@gmail.com>
  • Loading branch information
EyaOuenniche and ZeeshanTamboli committed Apr 6, 2024
1 parent 6a14922 commit f3cb496
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/mui-material/src/Select/Select.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,26 @@ export interface BaseSelectProps<Value = unknown>
variant?: SelectVariants;
}

export interface FilledSelectProps extends Omit<FilledInputProps, 'value' | 'onChange'> {
export interface FilledSelectProps
extends Omit<FilledInputProps, 'value' | 'onChange' | 'id' | 'classes' | 'inputProps'> {
/**
* The variant to use.
* @default 'outlined'
*/
variant: 'filled';
}

export interface StandardSelectProps extends Omit<InputProps, 'value' | 'onChange'> {
export interface StandardSelectProps
extends Omit<InputProps, 'value' | 'onChange' | 'id' | 'classes' | 'inputProps'> {
/**
* The variant to use.
* @default 'outlined'
*/
variant: 'standard';
}

export interface OutlinedSelectProps extends Omit<OutlinedInputProps, 'value' | 'onChange'> {
export interface OutlinedSelectProps
extends Omit<OutlinedInputProps, 'value' | 'onChange' | 'id' | 'classes' | 'inputProps'> {
/**
* The variant to use.
* @default 'outlined'
Expand All @@ -193,8 +196,8 @@ export type SelectProps<Value = unknown> =
* - [Select API](https://mui.com/material-ui/api/select/)
* - inherits [OutlinedInput API](https://mui.com/material-ui/api/outlined-input/)
*/
export default function Select<Value = unknown>(
props: SelectProps<Value>,
): JSX.Element & {
declare const Select: (<Value = unknown>(props: SelectProps<Value>) => JSX.Element) & {
muiName: string;
};

export default Select;
3 changes: 3 additions & 0 deletions packages/mui-material/src/Select/Select.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,6 @@ const AppSelect = <T extends string>(props: Props<T>) => {
</Select>
);
};

// test for applying Select's static muiName property type to wrapper components
AppSelect.muiName = Select.muiName;

0 comments on commit f3cb496

Please sign in to comment.