-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Intersection Flow Type error #1468
Comments
I'm seeing the same issue since I enabled |
Hope this helps, these are my steps to reproduce: // @flow
import React from 'react';
import type { ElementProps } from 'react';
import './button.scss';
type FooProps = ElementProps<'div'>;
function Foo(props: FooProps) {
return (
<div {...props} />
);
}
export default Foo; This errors (introduced additional prop 'bar'): // @flow
import React from 'react';
import type { ElementProps } from 'react';
import './button.scss';
type FooProps = ElementProps<'div'> & {
bar: string,
};
function Foo(props: FooProps) {
return (
<div {...props} />
);
}
Foo.defaultProps = {
bar: 'hello world',
}
export default Foo; |
Could be wrong, but seems related to this issue: #1413 |
we're also hitting this; with the additional issue that the reference intersection type is made available from our update: I've imported the type and also changed whether the intersection is before or after the other defined props (e.g. we get the same error as the OP in |
// @flow
type Opts = { name: string } & { kek: Function }
// eslint crash
function foo({ name }: Opts) {}
// no error
function foo(opts: Opts) {
const { name } = opts;
} eslint-react-plugin crashes when see union type destructuring |
I created an MR with a failing test case and hopefully a resolution to this. |
Fixed in #1563 |
Receiving the following error:
When attempting to use intersection flow type like so:
I looked through previous issues and PR's and noticed similar issues however I am not sure if this has been resolved or not or if I am not doing this correctly.
Also I am using version
7.4.0
of this plugin.The text was updated successfully, but these errors were encountered: