title: React/Redux reducer typescript error (Type 'undefined' is not assignable to type ISupplierState)
body: <p>I haven't been able to solve this issue for a long time even though I've been searching through various pages with similar problems.</p>
  <p>I'm receiving the following error:</p>
  <pre><code>src/app/store/instructor/supplier/reducer.tsx
  TypeScript error in src/app/store/instructor/supplier/reducer.tsx(11,7):
  Type '(state: ISupplierState | undefined, action: AnyAction) =&gt; { loading: true; suppliers: Supplier[]; errors?: string | undefined; } | { suppliers: any; loading: false; errors?: string | undefined; } | { ...; } | undefined' is not assignable to type 'Reducer&lt;ISupplierState, AnyAction&gt;'.
    Type '{ loading: true; suppliers: Supplier[]; errors?: string | undefined; } | { suppliers: any; loading: false; errors?: string | undefined; } | { loading: false; errors: any; suppliers: Supplier[]; } | undefined' is not assignable to type 'ISupplierState'.
      Type 'undefined' is not assignable to type 'ISupplierState'.  TS2322
  
       9 | };
      10 | 
    &gt; 11 | const reducer: Reducer&lt;ISupplierState&gt; = (state = initialState, action) =&gt; {
         |       ^
      12 |   switch (action.type) {
      13 |     case ISupplierActionTypes.ISUPPLIER_FETCH: {
      14 |       return {
  </code></pre>
  <p>Here is my reducer:</p>
  <pre><code>export const initialState: ISupplierState = {
    suppliers: [],
    loading: false,
    errors: undefined,
  };
  
  const reducer: Reducer&lt;ISupplierState&gt; = (state = initialState, action) =&gt; {
    switch (action.type) {
      case ISupplierActionTypes.ISUPPLIER_FETCH: {
        return {
          ...state,
          loading: true,
        };
      }
      case ISupplierActionTypes.ISUPPLIER_SUCCESS: {
        return {
          ...state,
          suppliers: action.payload,
          loading: false,
        };
      }
      case ISupplierActionTypes.ISUPPLIER_ERROR: {
        return {
          ...state,
          loading: false,
          errors: action.payload,
        };
      }
    }
  };
  
  export { reducer as iSupplierReducer };
  
  </code></pre>
  <p>Here is my types / ISupplierState:</p>
  <pre><code>export interface Supplier {
    name: string;
    id: number;
    payment_terms: number;
    address_id: number;
    delivery_time: number;
    bank_id: number;
    company_Type_id: number;
  }
  
  export interface ISupplier {
    suppliers: Supplier[];
  }
  
  export enum ISupplierActionTypes {
    ISUPPLIER_FETCH = '@@instructor/supplier/REQUEST',
    ISUPPLIER_SUCCESS = '@@instructor/supplier/SUCCESS',
    ISUPPLIER_ERROR = '@@instructor/supplier/ERROR',
  }
  
  export interface ISupplierState {
    readonly loading: boolean;
    readonly suppliers: Supplier[];
    readonly errors?: string;
  }
  </code></pre>
  <p>I understand the error code but I am able to do a very similar approach on another reducer without any issues. So I can't see why this is causing so much problem.</p>
  <p>I am using <code>Redux 7.2.0</code>
  Any help would be appreciated :)
  Thank you in advance.</p>