0
我描述这些接口:无法转换配合有效的打字稿值strore
enum ProductType {current, closed, coming}
export interface CurrentProductForCarousel {
type_product:ProductType.current;
offers: ProductMainInfo[]
}
export interface ProductMainInfo {
id: number;
disclaimer: string;
company?: {
registeredOfficeState?: string;
};
date: {
timestamp: number;
days: number;
hours: number;
};
}
我有NGRX店。我减速的样子响应
export interface State {
currentProductForCarousel: CurrentProductForCarousel | null;
}
export const initialState: State = {
сurrentProductForCarousel: null,
};
export function reducer(state = initialState, action:
pruduct.Actions): State {
switch (action.type) {
case pruductActions.FETCH_PRODUCTS_CURRENT_SUCCESS: {
return {
...state,
currentProductsForCarousel: action.payload,
};
}
例
{"success":true, "type_prudct":"current","products":[{"id":34, "disclaimer": "text", "company":{"registeredOfficeSuburb":"West Perth"}, "date":{"timestamp":1567987198,"days":710,"hours":"14"}}]}
问题是我怎么可以用正确类型的界面我来存储和比从商店获得的数据集的响应数据?