-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
prop-types failing to parse flow type annotations #1631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Here is a fairly small repro case. Removing the // @flow
import * as React from 'react'
type Props = {}
const func = <OP: *>(arg) => arg
const hoc = <OP>() => () => {
class Inner extends React.Component<Props & OP> {
render() {
return <div />
}
}
} |
What version of flow are you using? What's "OP"? |
I'm on flow 0.61, |
Oh, and I'm on eslint 4.4.1 and eslint-plugin-react v7.5.1. |
I am experiencing the same issue - it appears to be caused by using type intersections ( |
Seems like a dup of #1446 |
Probably so; but I'd prefer to leave both open until we're sure :-) |
Getting the same type ReduxState = {bar: number};
const mapStateToProps = (state: ReduxState) => ({
foo: state.bar,
})
// utility to extract the return type from a function
type ExtractReturn_<R, Fn: (...args: any[]) => R> = R;
type ExtractReturn<T> = ExtractReturn_<*, T>;
type PropsFromRedux = ExtractReturn<typeof mapStateToProps>;
type OwnProps = {
baz: string,
}
// I want my Props to be {baz: string, foo: number}
type Props = PropsFromRedux & OwnProps;
const Component = (props. Props) => (
<div>
{props.baz}
{props.foo}
</div>
); |
This presents in a very similar way to #1446, but it's happening in the prop-types rule, rather than no-unused-prop-types. It's related to flow type annotations, but unfortunately I don't have a good repro right now, I'll work on finding one. In the mean time, here it the stacktrace:
The text was updated successfully, but these errors were encountered: