eslint-plugin-flowtype-errors: React prop validation not supported
This code:
// @flow
import React, { Component } from 'react'
class Foo extends Component {
props: {
firstName: string,
lastName: string,
}
render() {
return (
<div>
<h1>Hello {this.props.firstName} {this.props.lastName}</h1>
</div>
)
}
}
class Bar extends Component {
render() {
return <Foo firstName="John" />
}
}
rightly fails typechecking with flow
because Bar
is not supplying all required props to Foo
:
6: props: {
^ property `lastName`. Property not found in
22: return <Foo firstName="John" />
^^^^^^^^^^^^^^^^^^^^^^^^ props of React element `Foo`
however eslint-plugin-flowtype-errors
doesn’t notice the problem.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (9 by maintainers)
I filed an issue for this with the Flow project.
Yep, it works! 👍