Closed
Description
TypeScript Version: 3.9.2
Search Terms:
- property-will-be-overwritten-by-spread
- 2783
- is specified more than once, so this usage will be overwritten
- spread
Code
import { Select } from '@material-ui/core';
import React from 'react';
export function Repro({ SelectProps = {} }: { SelectProps?: Partial<React.ComponentProps<typeof Select>> }) {
return (
<Select value={'test'} {...SelectProps} />
);
}
Expected behavior:
No error, as value
in SelectProps
is optional and SelectProps
even defaults to an empty object.
Actual behavior:
'value' is specified more than once, so this usage will be overwritten.ts(2783)
Repro.tsx(7, 32): This spread always overwrites this property.
Playground Link:
none, as the playground does not seem to load the material-ui types