-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
override candidate?Whether or not an issue should be solved with an override or in conversion or upstreamWhether or not an issue should be solved with an override or in conversion or upstreamtype differenceAll about differences between Flow and TS typings (e.g. in React)All about differences between Flow and TS typings (e.g. in React)
Description
There seem to be only a few of these, one is here. Perhaps best to solve with an override.
import * as React from "react"
class Foo extends React.Component<{ mode?: null | undefined | ("dialog" | "dropdown") }> {
static defaultProps: {
// This supertype here makes it no longer match the React.ComponentClass interface,
// which is used in React.ComponentType
mode: string
// This works
// mode?: null | undefined | ("dialog" | "dropdown")
}
}
type ExtractProps<X> = X extends React.ComponentType<infer P> ? P : never
type Props = ExtractProps<typeof Foo>
const props: Props = { mode: "dialog" }React.ComponentClass is defined here.
Metadata
Metadata
Assignees
Labels
override candidate?Whether or not an issue should be solved with an override or in conversion or upstreamWhether or not an issue should be solved with an override or in conversion or upstreamtype differenceAll about differences between Flow and TS typings (e.g. in React)All about differences between Flow and TS typings (e.g. in React)