facebook / facebook/flow

bad property not found error related to spread props, object intersections, and import type order

Open
#2,975 0 comments 3 reactions 0 assignees View on GitHub
Typing: unions/intersections
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Flow 0.36.0

`temp1.js`

```es6
// @flow

export type BaseAxisProps = {
side: string,
}

export type AxisProps = BaseAxisProps & {
range: Array
}
```

`temp2.js`

```es6
// @flow

import type {AxisProps, BaseAxisProps} from './temp1'

// if you use this order instead, the error goes away!
// import type {BaseAxisProps, AxisProps} from './temp1'

type UncontrolledAxisProps = BaseAxisProps & {defaultRange: Array}

function convert(axis: UncontrolledAxisProps): AxisProps {
return {
...axis,
range: axis.defaultRange,
}
}
```

```
temp1.js:7
7: export type AxisProps = BaseAxisProps & {
^^^^^^^^^^^^^ property `side`. Property not found in
11: return {
^ object literal. See: temp2.js:11
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.