Getting Typescript error from MUI Autocomplete source code

47 Views Asked by At

Following the source code from MUI docs to build a simple autocomplete component:

<Autocomplete
    disablePortal
    id="combo-box-demo"
    options={allGroups}
    sx={{ width: 300 }}
    renderInput={(params) => <TextField {...params} label="Groups" />}
  />

This is giving a type error on the Textfield component (coming from params), which bubbles down to:

Type '"small" | undefined' is not assignable to type 'OverridableStringUnion<"small" | "medium", TextFieldPropsSizeOverrides>'.
  Type 'undefined' is not assignable to type 'OverridableStringUnion<"small" | "medium", TextFieldPropsSizeOverrides>'.ts(2375)

So the source code types are just broken?

Is there a workaround or alternative component I can pass to renderInput?

0

There are 0 best solutions below