声明一个扩展另一个多态类的多态类

问题描述:

我在React中编写了一个组件,它希望接收一个组件,该组件拥有一个通过ref访问的特定字段onPropChange作为道具。声明一个扩展另一个多态类的多态类

/* @flow */ 
import * as React from 'react'; 

type onPropChangeObject<Props> = { 
    [key: $Keys<Props>]: (newValue: any) => void 
} 

declare class PropWatchableComponent<DefaultProps, Props: Object, State> 
    extends React.Component<DefaultProps, Props, State> 
{ 
    onPropChange?: onPropChangeObject<Props>; 
} 

但类型检查失败,多个错误的流量(0.39.0)as seen here

8: declare class PropWatchableComponent<DefaultProps, Props: Object, State> extends React.Component<DefaultProps, Props, State> { ^undefined. Did you forget to declare some incompatible instantiation of `DefaultProps`?. This type is incompatible with 
8: declare class PropWatchableComponent<DefaultProps, Props: Object, State> extends React.Component<DefaultProps, Props, State> { ^some incompatible instantiation of `DefaultProps` 
8: declare class PropWatchableComponent<DefaultProps, Props: Object, State> extends React.Component<DefaultProps, Props, State> { ^undefined. Did you forget to declare some incompatible instantiation of `State`?. This type is incompatible with 
8: declare class PropWatchableComponent<DefaultProps, Props: Object, State> extends React.Component<DefaultProps, Props, State> { ^some incompatible instantiation of `State` 
8: declare class PropWatchableComponent<DefaultProps, Props: Object, State> extends React.Component<DefaultProps, Props, State> { 
             ^DefaultProps. This type is incompatible with 
8: declare class PropWatchableComponent<DefaultProps, Props: Object, State> extends React.Component<DefaultProps, Props, State> { 
             ^undefined. Did you forget to declare DefaultProps? 
8: declare class PropWatchableComponent<DefaultProps, Props: Object, State> extends React.Component<DefaultProps, Props, State> { 
                    ^State. This type is incompatible with 
8: declare class PropWatchableComponent<DefaultProps, Props: Object, State> extends React.Component<DefaultProps, Props, State> { 
                    ^undefined. Did you forget to declare State? 

的最新版本是什么这一切谈论不确定?我清楚地声明了DefaultPropsState作为类型参数。我忘了什么?