在定義 a 時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[]; }但是 flow 一直在抱怨,特別是關于endpoints ?: string[];: ? undefined [2] is incompatible with array type [3] in property endpoints.我該怎么做才能讓它發揮作用?
當我嘗試實現接口時,為什么 flowtype 會抱怨?
慕絲7291255
2021-10-14 15:51:25