Home > Enterprise >  How can I avoid any type in redux Typescript
How can I avoid any type in redux Typescript

Time:09-22

I want to avoid "any" type in the react-redux typescript project. I am new to typescript but I love it but I don't understand where I should use any type.

Where to use it and where not to use it?

import { createSlice } from "@reduxjs/toolkit";

export interface InitialState {
    id: string,
    name: string
}

const initialState: InitialState[] = [
    {id: '0', name: 'Jony'},
    {id: '1', name: 'kete'}
];


const userSlice = createSlice({
    name: 'users',
    initialState,
    reducers:{}
})

//Here I don't want to use any type           
  • Related