Hey basir I really need your help with this error I have when trying to implement the useReducer I am getting.. type Action =
{ type: ‘FETCH_REQUEST’}
{
type: ‘FETCH_SUCCESS’
payload: Product[];
}
{ type: ‘FETCH_FAIL’;
payload: string }..
I believe it is a typescript error, when i try to click on the error by Product[] it says ‘Product’ only refers to a type, but is being used as a value here.ts(2693), and it says the same thing for the next line of code for the fetch fail as well. type: ‘FETCH_FAIL’;
payload: string }
would greatly appreciate it if you can get back to me!
hello there,
thanks for your interest.
please share the code on github to take a look.
also check this answer to see if it works for you:
https://bobbyhadz.com/blog/typescript-instanceof-only-refers-to-type-but-is-being-used-as-value