facebook / facebook/flow

share type definitions among libs

Open
#3,883 6 comments 7 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

It seems type definitions cannot share among different lib file. Is this a bug or any other extra configurations are needed?

#### ./flow/dto/ProductDTO.js

```js
// @flow
export type ProductDTO = {
id: number,
name: string,
img: string,
}

export type TestState = {
products: Array,
}
```

#### ./flow/redux/ProductStates.js

```js
// @flow
// I even tried to import type { ProductDTO } from '../dto/ProductDTO';
export type ProductState = {
products: Array,
}
```

#### example.js

```js
// @flow
const Test1: TestState = {
products: ['xxx'], // flow error report here as expected
}

const Test2: ProductState = {
products: ['xxx'], // no error, it seems flow does not recognize ProductState
}
```

#### .flowconfig

...
[libs]
flow
...

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.