【发布时间】:2018-11-10 06:45:44
【问题描述】:
我是新流程,目前正在从事流程严格的项目。我有一个类型别名被传递给一个类。 sn-p 可以找到here
// @flow strict
export type CustomType = {
a: string,
b: boolean,
c: boolean,
d: boolean,
e: boolean
};
let d = true;
let b = true;
let customType:CustomType = {
d,
b,
c: true,
}
class Custom{
constructor(customType = {}) {}
}
let custom = new Custom(customType);
传递对象时,并非所有属性 customType 都存在。这里最好的解决方法是什么?
【问题讨论】:
标签: flowtype