diff --git a/docs/src/pages/components/autocomplete/CustomInputAutocomplete.js b/docs/src/pages/components/autocomplete/CustomInputAutocomplete.js index 242ad21344972b..84a0ff2a1a63fb 100644 --- a/docs/src/pages/components/autocomplete/CustomInputAutocomplete.js +++ b/docs/src/pages/components/autocomplete/CustomInputAutocomplete.js @@ -24,7 +24,6 @@ export default function CustomInputAutocomplete() { diff --git a/docs/src/pages/components/autocomplete/CustomInputAutocomplete.tsx b/docs/src/pages/components/autocomplete/CustomInputAutocomplete.tsx index 0a45182ee6bcb7..19b0fee143c15e 100644 --- a/docs/src/pages/components/autocomplete/CustomInputAutocomplete.tsx +++ b/docs/src/pages/components/autocomplete/CustomInputAutocomplete.tsx @@ -26,7 +26,6 @@ export default function CustomInputAutocomplete() { diff --git a/packages/material-ui/src/Autocomplete/Autocomplete.d.ts b/packages/material-ui/src/Autocomplete/Autocomplete.d.ts index 2808ee08ee3169..d5cbd5a2920f35 100644 --- a/packages/material-ui/src/Autocomplete/Autocomplete.d.ts +++ b/packages/material-ui/src/Autocomplete/Autocomplete.d.ts @@ -1,7 +1,8 @@ import * as React from 'react'; import { InternalStandardProps as StandardProps } from '@material-ui/core'; +import { ChipProps, ChipTypeMap } from '@material-ui/core/Chip'; import { PopperProps } from '@material-ui/core/Popper'; -import { +import useAutocomplete, { AutocompleteChangeDetails, AutocompleteChangeReason, AutocompleteCloseReason, @@ -36,27 +37,28 @@ export interface AutocompleteRenderInputParams { disabled: boolean; fullWidth: boolean; size: 'small' | undefined; - InputLabelProps: object; + InputLabelProps: ReturnType['getInputLabelProps']>; InputProps: { ref: React.Ref; className: string; startAdornment: React.ReactNode; endAdornment: React.ReactNode; }; - inputProps: object; + inputProps: ReturnType['getInputProps']>; } export interface AutocompleteProps< T, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, - FreeSolo extends boolean | undefined + FreeSolo extends boolean | undefined, + ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent'] > extends UseAutocompleteProps, StandardProps, 'defaultValue' | 'onChange' | 'children'> { /** * Props applied to the [`Chip`](/api/chip/) element. */ - ChipProps?: object; + ChipProps?: ChipProps; /** * Override or extend the styles applied to the component. */ @@ -165,7 +167,7 @@ export interface AutocompleteProps< /** * Props applied to the Listbox element. */ - ListboxProps?: object; + ListboxProps?: ReturnType['getListboxProps']>; /** * If `true`, the component is in a loading state. * @default false diff --git a/packages/material-ui/src/Autocomplete/Autocomplete.spec.tsx b/packages/material-ui/src/Autocomplete/Autocomplete.spec.tsx index 510b4dfdfc72c1..c5bf88874dc406 100644 --- a/packages/material-ui/src/Autocomplete/Autocomplete.spec.tsx +++ b/packages/material-ui/src/Autocomplete/Autocomplete.spec.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { InputLabelProps } from '@material-ui/core'; import { Autocomplete, AutocompleteProps } from '@material-ui/lab'; import { expectType } from '@material-ui/types'; diff --git a/packages/material-ui/src/useAutocomplete/useAutocomplete.d.ts b/packages/material-ui/src/useAutocomplete/useAutocomplete.d.ts index de93cc380b415d..657bacd9d009eb 100644 --- a/packages/material-ui/src/useAutocomplete/useAutocomplete.d.ts +++ b/packages/material-ui/src/useAutocomplete/useAutocomplete.d.ts @@ -295,7 +295,8 @@ export default function useAutocomplete< ): { getRootProps: () => React.HTMLAttributes; getInputProps: () => React.HTMLAttributes; - getInputLabelProps: () => React.HTMLAttributes; + // We pass `getInputLabelProps()` to `@material-ui/core/InputLabel` which does not implement HTMLLabelElement#color. + getInputLabelProps: () => Omit, 'color'>; getClearProps: () => React.HTMLAttributes; getPopupIndicatorProps: () => React.HTMLAttributes; getTagProps: ({ index }: { index: number }) => React.HTMLAttributes;