我想限制模块导出功能的类型
type PropertyRequest = ItemGetRequest | ItemUpdateRequest<Property>
type PropertyResponse = Property | ItemUpdateResponse<Property>
type PropertyHandlers = {[key: string]: Handler<PropertyRequest, PropertyResponse>}
export { propertyGet, propertyUpdate } as PropertyHandlers
,但是语法export {...} as Type
似乎不正确或在3.4.1中不受支持。我该如何解决?
答案 0 :(得分:0)
导出中不支持类型断言的语法,您将必须声明一个变量并将其导出:
const defaultExport: PropertyHandlers = { propertyGet, propertyUpdate };
export default defaultExport