export interface ProductState{
showProductCode: boolean;
currentProduct: Product;
products: Product[];
}
const InitialValue ={
showProductCode: true,
currentProduct: null,
products: []
} as ProductState;
export function reducer(state: InitialValue, action): ProductState{
switch(action.type){
case 'TOGGLE_PRODUCT_CODE':
console.log('exisiting state :' + JSON.stringify(state));
console.log('payload :' + action.payload);
return{
...state,
showProductCode: action.payload
};
default:
return state;
}
}
;
Ошибка получения
{
"resource": "...",
"owner": "typescript",
"code": "2749",
"severity": 8,
"message": "'InitialValue' refers to a value, but is being used as a type here.",
"source": "ts",
"startLineNumber": 40,
"startColumn": 32,
"endLineNumber": 40,
"endColumn": 44
}