Generics 扩展流类型类泛型参数
我有一个基于通用Generics 扩展流类型类泛型参数,generics,flowtype,extends,Generics,Flowtype,Extends,我有一个基于通用组件类型的具体类型: type Props = {||} type State = {| count: number |} class MyComponent extends Component<Props, State> { state = { count: 42 } } 我尝试使用类型交叉点,如下所示: class MyComponent<S> extends Component<Props, S & State&g
组件类型的具体类型:
type Props = {||}
type State = {|
count: number
|}
class MyComponent extends Component<Props, State> {
state = {
count: 42
}
}
我尝试使用类型交叉点,如下所示:
class MyComponent<S> extends Component<Props, S & State> {
类MyComponent扩展组件{
但它不适用于Flow()
如何实现我的目标,有什么建议吗?对我有用:对我来说没有:
class MyComponent<S> extends Component<Props, S & State> {