Closed leighman closed 6 years ago
Using Exact to correct overly broad Props types with React
Exact
interface Props { something: string } class Blah<T extends Exact<Props, T>> extends React.PureComponent<T> {} ... const foo: any = 1 return (<Blah something="test" foo={foo} />)
seems to be accepted.
Changing to export type Exact<A extends object, B extends A> = A & Record<Exclude<keyof B, keyof A>, never> works as I would expect.
export type Exact<A extends object, B extends A> = A & Record<Exclude<keyof B, keyof A>, never>
Is there a reason that undefined is used? Should I be using RowLacks or something instead?
undefined
RowLacks
Is there a reason that undefined is used?
Actually no, thanks for pointing out. I'll put up a PR
Using
Exact
to correct overly broad Props types with Reactseems to be accepted.
Changing to
export type Exact<A extends object, B extends A> = A & Record<Exclude<keyof B, keyof A>, never>
works as I would expect.Is there a reason that
undefined
is used? Should I be usingRowLacks
or something instead?