Open eliseumds opened 7 years ago
I think the linked issue explains this reasonably well. This is expected though confusing behavior. I’m going to close this issue since it’s not a bug, but am happy to help with adjusting that code to work.
Returning a misleading, unhelpful error message to the user does sound a bit like a bug, though !
I definitely agree with @dperetti.
This is now improved in Flow 0.55! I had to remove the JSX from the example because Try Flow currently isn't working with JSX. After doing that, the new error message is:
33: const { size, tracking, ...otherProps } = this.props;
^ property `size`. Property cannot be accessed on any member of intersection type
33: const { size, tracking, ...otherProps } = this.props;
^ intersection
Member 1:
26: type ColProps = BoxProps & {
^ BoxPropsError:
33: const { size, tracking, ...otherProps } = this.props;
^ property `size`. Property not found in
26: type ColProps = BoxProps & {
^ object type
Member 2:
26: type ColProps = BoxProps & { ^ object typeError:
38: mapPropToClass('size', size);
^ number. This type is incompatible with the expected param type of
8: function mapPropToClass(key: string, prop: Object) {
^ object type
Which helps us reconstruct Flow's reasoning:
BoxProps
I think this makes stuff a lot clearer and so this issue is fixed. WDYT, @eliseumds?
@asolove-stripe sweet! That's way more useful, thanks =)
38: mapPropToClass('size', size);
^ number. This type is incompatible with the expected param type of
This part of the error seems bogus, right? Like the error position is way off.
Check out line 38 of the following example: https://goo.gl/AdmME5. Does anyone know why it's failing with
property 'size'. Property cannot be accessed on any member of intersection type...
instead of pointing out first that the second argument passed tomapPropToClass
is incorrect?