2016-12-28 9 views
2

Reactコンポーネントに多相を使用しようとしていますが、「このタイプはVの互換性のないインスタンス化と互換性がありません」というエラーが表示されています。フロータイプの多型が機能しない

// @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> 
    } 
} 

Link to Playground:ここ

はコードです。

私は間違っていますか?

答えて

関連する問題