例如,给出以下记录:
type UserRecord = {
id: string;
name: ?string;
age: number;
}
Run Code Online (Sandbox Code Playgroud)
有没有办法做相同的以下内容:
/* @flow */
import { List, Map } from 'immutable'
const users: List<Map<UserRecord>> = List();
let user: Map<UserRecord>;
user = Map({ id: '666', age: 30 });
users.push(user);
Run Code Online (Sandbox Code Playgroud)
否则我最终会简单地使用类似于Map<string, any>我认为将Immutable.js与Flow类型系统一起使用的东西.