From 7b08d8a7bf04eb6c68ea641c86f6debf2adb1a0b Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 11 Mar 2022 15:42:42 -0600 Subject: [PATCH] test: drop RecursivePartial type There is an existing type we can use instead. --- test/index.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/index.tsx b/test/index.tsx index 808a7ab1..93344cab 100644 --- a/test/index.tsx +++ b/test/index.tsx @@ -5,25 +5,21 @@ import { I18nContext, I18nManager } from '@shopify/react-i18n'; import { RenderResult, render } from '@testing-library/react'; import React, { ReactElement } from 'react'; import { Provider } from 'react-redux'; -import { AnyAction, PreloadedState, createStore } from 'redux'; +import { AnyAction, DeepPartial, PreloadedState, createStore } from 'redux'; import { END, MulticastChannel, Saga, Task, runSaga, stdChannel } from 'redux-saga'; import { RootState, rootReducer } from '../src/reducers'; import { RootSagaContext } from '../src/sagas'; -type RecursivePartial = { - [P in keyof T]?: RecursivePartial; -}; - export class AsyncSaga { private channel: MulticastChannel; private dispatches: (AnyAction | END)[]; private takers: { put: (action: AnyAction | END) => void }[]; - private state: RecursivePartial; + private state: DeepPartial; private task: Task; public constructor( saga: Saga, - state: RecursivePartial = {}, + state: DeepPartial = {}, context?: Partial, ) { this.channel = stdChannel(); @@ -76,7 +72,7 @@ export class AsyncSaga { return Promise.resolve(next); } - public updateState(state: RecursivePartial): void { + public updateState(state: DeepPartial): void { for (const key of Object.keys(state) as Array) { // @ts-expect-error: writing to readonly for testing this.state[key] = { ...this.state[key], ...state[key] };