2017-06-06 16 views
2

フローとの互換性がありません明示的に渡された文字列がnullと互換性がありません、また、渡される爆発物とは何かを持っているようだと私に語っている。flowtype-文字列がnull

私が持っています私の中で次のブートストラップライブラリインタフェース定義ファイル反応:これは右、罰金のようです

import { FormControl, type FormControlProps } from 'react-bootstrap'; 

type EnumSelectProps = {| 
    defaultText: string, 
    ...FormControlProps, 
|}; 

// and in the render method: 
    const { defaultText, ...other: FormControlProps } = this.props; 

    <FormControl 
    {...other} 
    componentClass="select" 
    value={this.state.value} 
    onChange={event => this.onChange(event.target.value)} 
    > 
    { children } 
    </FormControl> 

declare export type FormControlProps = {| 
    componentClass?: ?componentClass, 
    // componentClass is an enum of strings 'select' | 'div' etc 
    // There are other params here, too. 
|} 

とコンポーネントに次のように? ...otherのタイプはFormControlPropsです。しかし、私は苦情を受け取ります:

  v----------- 
43:  <FormControl 
44:   {...other} 
45:   componentClass="select" 
...: 
48:  > 
     ^props of React element `FormControl` 
45:   componentClass="select" 
          ^^^^^^^^ string. This type is incompatible with 
463:  componentClass?: ?componentClass, 
          ^^^^^^^^^^^^^^^ null. See lib: flow-typed/npm/react-bootstrap_v0.x.x.js:463 

何がありますか? otherany(つまり...(other: any))と入力すると動作します。また、componentClassを左側のオプションのcomponentClass?: componentClassにすると動作します。しかし、これは正しい定義ではありません。これを処理する方法はそれほどハックリではありませんか?ありがとうございました!

答えて

関連する問題