为什么当我尝试实现一个接口时 flowtype 会报错?

Why does flowtype complain when I try to implement an interface?

在定义 libdef 时,我有:

declare class Resource implements ResourceOptions {
        app ? : Express | Router;
        sequelize ? : Sequelize;
        model: any;
        endpoints ? : string[];
        actions ? : Array < "create" | "read" | "update" | "delete" | "list" > ;
        include ? : any[];
        pagination ? : boolean;
        updateMethod ? : "POST" | "PUT" | "PATCH";
        search ? : SearchOptions | SearchOptions[];
        sort ? : SortOptions;
        reloadInstances ? : boolean;
        associations ? : boolean;
        excludeAttributes ? : string[];
        readOnlyAttributes ? : string[];
        associationOptions: any;
        attributes: any;
        projects: any;
        controllers: any;
        create: Controllers$create;
        read: Controllers$read;
        update: Controllers$update;
        delete: Controllers$update;
        list: Controllers$list;
        all: Controllers$all;
        associationsInfo: any;
        use: any;
    }

和:

declare interface ResourceOptions {
        app ? : Express | Router;
        sequelize ? : Sequelize;
        model: any;
        endpoints ? : string[];
        actions ? : Array < "create" | "read" | "update" | "delete" | "list" > ;
        include ? : any[];
        pagination ? : boolean;
        updateMethod ? : "POST" | "PUT" | "PATCH";
        search ? : SearchOptions | SearchOptions[];
        sort ? : SortOptions;
        reloadInstances ? : boolean;
        associations ? : boolean;
        excludeAttributes ? : string[];
        readOnlyAttributes ? : string[];
    }

但是流量一直在抱怨,特别是关于 endpoints ?: string[];:

 • undefined [2] is incompatible with array type [3] in property endpoints.

我该怎么做才能让它发挥作用?

我不是 类 和界面如何在流程中交互的专家,但基本上界面不允许 属性 存在但未定义的可能性。如果将 void 并入 属性 类型,则错误将 go away.