FlowType 是否支持混合或组合?

Does FlowType support mixins or composition?

flow 是否支持如下 mixin?

// spark.js
import {includeEmitterIn} from 'emitter';
export default class Spark {
  constructor() {
    includeEmitterIn(this);
  }
  doSomething() {
    this.emit();
  }
}

// emitter.js
export function includeEmitterIn(obj) {
  obj.emit = function(callback) {
    //...
  }
}

使用更新版本的 Flowtype,您现在可以像这样进行混合:

class A {}
class B {}

class C mixins A, B {}

虽然不知道这是在哪个版本中引入的,抱歉。文档不是最好的,但我现在正在使用此功能。

编辑:看起来它们是在 0.16.0

中添加的