-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
[material-ui][TablePagination] Fix type error in Select props #39137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d62e722
c045a78
06fe8a6
36bb915
8e7ca98
1b031bf
778e977
d6f55af
e98b439
a8b36c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,12 @@ import { MenuProps } from '../Menu'; | |
import { SelectChangeEvent, SelectInputProps } from './SelectInput'; | ||
import { SelectClasses } from './selectClasses'; | ||
import { OutlinedInputProps } from '../OutlinedInput'; | ||
import { FilledInputProps } from '../FilledInput'; | ||
|
||
export { SelectChangeEvent }; | ||
|
||
export interface SelectProps<Value = unknown> | ||
extends StandardProps<InputProps, 'value' | 'onChange'>, | ||
Omit<OutlinedInputProps, 'value' | 'onChange'> { | ||
export interface BaseSelectProps<Value = unknown> | ||
extends StandardProps<InputProps, 'value' | 'onChange'> { | ||
/** | ||
* If `true`, the width of the popover will automatically be set according to the items inside the | ||
* menu, otherwise it will be at least the width of the select input. | ||
|
@@ -148,9 +148,45 @@ export interface SelectProps<Value = unknown> | |
* The variant to use. | ||
* @default 'outlined' | ||
*/ | ||
variant?: 'standard' | 'outlined' | 'filled'; | ||
variant?: 'filled' | 'standard' | 'outlined'; | ||
} | ||
|
||
export interface FilledSelectProps extends Omit<FilledInputProps, 'value' | 'onChange'> { | ||
/** | ||
* The variant to use. | ||
* @default 'outlined' | ||
*/ | ||
variant: 'filled'; | ||
} | ||
|
||
export interface StandardSelectProps extends Omit<InputProps, 'value' | 'onChange'> { | ||
/** | ||
* The variant to use. | ||
* @default 'outlined' | ||
*/ | ||
variant: 'standard'; | ||
} | ||
|
||
export interface OutlinedSelectProps extends Omit<OutlinedInputProps, 'value' | 'onChange'> { | ||
/** | ||
* The variant to use. | ||
* @default 'outlined' | ||
*/ | ||
variant: 'outlined'; | ||
} | ||
|
||
export type SelectVariants = 'outlined' | 'standard' | 'filled'; | ||
|
||
export type SelectProps< | ||
Value = unknown, | ||
Variant extends SelectVariants = SelectVariants, | ||
> = BaseSelectProps<Value> & | ||
(Variant extends 'filled' | ||
? FilledSelectProps | ||
: Variant extends 'standard' | ||
? StandardSelectProps | ||
: OutlinedSelectProps); | ||
Comment on lines
+180
to
+188
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, this is breaking type change for people using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed it in #41359 |
||
|
||
/** | ||
* | ||
* Demos: | ||
|
@@ -162,8 +198,15 @@ export interface SelectProps<Value = unknown> | |
* - [Select API](https://mui.com/material-ui/api/select/) | ||
* - inherits [OutlinedInput API](https://mui.com/material-ui/api/outlined-input/) | ||
*/ | ||
declare const Select: (<Value>(props: SelectProps<Value>) => JSX.Element) & { | ||
|
||
export default function Select<Value = unknown, Variant extends SelectVariants = 'outlined'>( | ||
props: { | ||
/** | ||
* The variant to use. | ||
* @default 'outlined' | ||
*/ | ||
variant?: Variant; | ||
} & Omit<SelectProps<Value, Variant>, 'variant'>, | ||
): JSX.Element & { | ||
muiName: string; | ||
}; | ||
|
||
export default Select; |
Uh oh!
There was an error while loading. Please reload this page.