Files
pybricks-code/src/terminal/actions.ts
T
David Lechner 9641898a75 actions: refactor actions
The pattern we were using for actions required actions to be defined in
three places, an enum member containing the type string, an type
definition and a function. This combines all three of these into one by
using a helper function based on the ideas from [1].

[1]: https://phryneas.de/redux-typescript-no-discriminating-union
2022-02-25 17:58:30 -06:00

15 lines
368 B
TypeScript

// SPDX-License-Identifier: MIT
// Copyright (c) 2020,2022 The Pybricks Authors
import { createAction } from '../actions';
export const sendData = createAction((data: string) => ({
type: 'terminal.action.sendData',
value: data,
}));
export const receiveData = createAction((data: string) => ({
type: 'terminal.action.receiveData',
value: data,
}));