似乎类型定义不能在不同的lib文件之间共享。这是一个bug还是需要任何其他额外配置?
// @flow
export type ProductDTO = {
id: number,
name: string,
img: string,
}
export type TestState = {
products: Array<ProductDTO>,
}
// @flow
// I even tried to import type { .ProductDTO } from '../dto/ProductDTO';
export type ProductState = {
products: Array<ProductDTO>,
}
// @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
}
...
[库]
流
...