Skip to content

Commit a3e371c

Browse files
authored
(Autocomplete type issue) when multiple and Templates are used (#7986)
1 parent 43598a2 commit a3e371c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

components/lib/autocomplete/autocomplete.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export interface AutoCompleteContext {
230230
* Defines valid properties in AutoComplete component. In addition to these, all properties of HTMLSpanElement can be used in this component.
231231
* @group Properties
232232
*/
233-
export interface AutoCompleteProps<T = any> extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, 'onChange' | 'onSelect' | 'ref' | 'value'> {
233+
export interface AutoCompleteProps<T = any, M extends boolean = false> extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, 'onChange' | 'onSelect' | 'ref' | 'value'> {
234234
/**
235235
* Unique identifier of the element.
236236
*/
@@ -349,7 +349,7 @@ export interface AutoCompleteProps<T = any> extends Omit<React.DetailedHTMLProps
349349
* Specifies if multiple values can be selected.
350350
* @defaultValue false
351351
*/
352-
multiple?: boolean | undefined;
352+
multiple?: M;
353353
/**
354354
* Number of maximum options that can be selected.
355355
*/
@@ -451,7 +451,7 @@ export interface AutoCompleteProps<T = any> extends Omit<React.DetailedHTMLProps
451451
/**
452452
* Value of the component.
453453
*/
454-
value?: this['multiple'] extends true ? T[] : T | string | number | readonly string[] | undefined;
454+
value?: M extends true ? T[] : T | string | number | readonly string[] | undefined;
455455
/**
456456
* Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it.
457457
* @type {VirtualScrollerProps}
@@ -471,7 +471,7 @@ export interface AutoCompleteProps<T = any> extends Omit<React.DetailedHTMLProps
471471
* Callback to invoke when autocomplete value changes.
472472
* @param {AutoCompleteChangeEvent} event - Custom change event.
473473
*/
474-
onChange?(event: AutoCompleteChangeEvent<T>): void;
474+
onChange?(event: AutoCompleteChangeEvent<M extends true ? T[] : T>): void;
475475
/**
476476
* Callback to invoke when input is cleared by the user.
477477
* @param {React.SyntheticEvent} event - Browser event.
@@ -568,7 +568,7 @@ export interface AutoCompleteProps<T = any> extends Omit<React.DetailedHTMLProps
568568
*
569569
* @group Component
570570
*/
571-
export declare class AutoComplete<T = any> extends React.Component<AutoCompleteProps<T>, any> {
571+
export declare class AutoComplete<T = any, M extends boolean = false> extends React.Component<AutoCompleteProps<T, M>, any> {
572572
/**
573573
* Used to show the overlay.
574574
*/

0 commit comments

Comments
 (0)