material-components/material-components-web-react

text-field: Input component uses Exclude to get rid of 'ref' property while it should use Omit

thdk opened this issue · 1 comments

thdk commented

Typescript 'Exclude' only works for union types.

in text-fiels/Input.tsx Exclude<T, U> is used to remove the ref property from the React.HTMLProps

This doesn't do anything resulting people can still pass the ref property as a prop of the Input component. Which is obviously not used at all in the component.

My suggestion would be to use Omit, but that type is only included in typescript 3.5.0 while the current typescript version specified in the root package.json is still 3.3.3.

Can we increase the version of the typescript dependency at use Omit or should we use the following type:

type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

thdk commented

I can do this simple PR but I need to know if I may use Omit from typescript 3.5.0 and if I may increase the version of typescript dependency in the root package.json.