0
下面是函數簽名,如何定義對象主要爲字符串類型
export function getVideoBooleansParamsString(videoBooleans: {
string: { label: string; value: boolean }
}): string {}
這是arg
我試圖進入,
const videoBooleans = { video: { label: 'video', value: true } }
而且它產生以下錯誤,
(63,33): error TS2345: Argument of type '{ exchange: { filterType: string; filterValues: string[]; }; }' is not assignable to parameter of type '{string: FilterModel; }'.
Property 'string' is missing in type '{ exchange: { filterType: string; filterValues: string[]; }; }'.
我打算聲明的是一個對象,無論密鑰是否具有內容{ label: string; value: boolean }