2
我想用Reforma组件的继承使用多态性,但是我看到“这种类型与V的一些不兼容的实例不兼容”错误。Flowtype多态性不能正常工作
下面是代码:
// @flow
import React, { Component } from 'react'
type BaseProps = {
name: string
}
type BaseState<T> = {
error: string,
value: ?T,
}
class Base<Props, V> extends Component<any, BaseProps & Props, BaseState<V>> {
state = {
error: '',
value: null,
}
render() {
return <div>this.props.name</div>
}
}
type ExtendedProps = {
foo: string,
}
class ExtendedBase extends Base<ExtendedProps, string> {
render() {
return <div>this.props.name</div>
}
}
我在做什么错?