drop FirmwareSagaContext

This context is not exclusive to the firmware sagas.
This commit is contained in:
David Lechner
2022-03-26 16:10:28 -05:00
parent 54a475cebc
commit 07a03d4ea7
3 changed files with 5 additions and 15 deletions
-1
View File
@@ -6,7 +6,6 @@ import {
FirmwareReaderError,
FirmwareReaderErrorCode,
} from '@pybricks/firmware';
import { mock } from 'jest-mock-extended';
import JSZip from 'jszip';
import { AsyncSaga } from '../../test';
import {
+1 -11
View File
@@ -65,16 +65,6 @@ import {
flashFirmware,
} from './actions';
/**
* Function that returns the next unused message ID.
*/
type NextMessageIdFunc = () => number;
/**
* Partial saga context type for context used in the firmware sagas.
*/
export type FirmwareSagaContext = { nextMessageId: NextMessageIdFunc };
const firmwareZipMap = new Map<HubType, string>([
[HubType.CityHub, cityHubZip],
[HubType.TechnicHub, technicHubZip],
@@ -305,7 +295,7 @@ function* handleFlashFirmware(action: ReturnType<typeof flashFirmware>): Generat
return;
}
const nextMessageId = yield* getContext<NextMessageIdFunc>('nextMessageId');
const nextMessageId = yield* getContext<() => number>('nextMessageId');
const infoAction = yield* put(infoRequest(nextMessageId()));
const { info } = yield* all({
+4 -3
View File
@@ -10,7 +10,7 @@ import editor from './editor/sagas';
import errorLog from './error-log/sagas';
import explorer from './explorer/sagas';
import fileStorage from './fileStorage/sagas';
import flashFirmware, { FirmwareSagaContext } from './firmware/sagas';
import flashFirmware from './firmware/sagas';
import hub from './hub/sagas';
import lwp3BootloaderProtocol from './lwp3-bootloader/sagas';
import lwp3BootloaderBle from './lwp3-bootloader/sagas-ble';
@@ -42,6 +42,7 @@ export default function* (): Generator {
/**
* Combined type for all saga contexts.
*/
export type RootSagaContext = FirmwareSagaContext &
NotificationSagaContext &
export type RootSagaContext = {
nextMessageId: () => number;
} & NotificationSagaContext &
TerminalSagaContext;