Commit Graph
10 Commits
Author SHA1 Message Date
David Lechner a9f4eaa32d actions: simplify usage of Matchable
This removes use of the pseudo-internal toString() function and also
removes extraneous uses of ReturnType<>. Also, a new when() method
is added to simplify additional uses.
2022-02-26 12:43:10 -06:00
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
David Lechner 5f7a63fe5a ble-lwp3-service/protocol: add enums for hub types
This is the full list of hub types.
2021-12-27 12:38:51 -06:00
David Lechner e7d44ea9a9 src/utils: add ensureError() function
Typescript v4.4 no longer assumes that the error in catch is an Error
object [1]. This adds a helper function to ensure that caught errors
at least match the Error interface. If not, it creates a new Error
object with the value as the message.

[1]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-beta/#using-unknown-in-catch-variables
2021-08-30 13:06:01 -05:00
David Lechner 956b6f3c96 firmware: add windows BLE hacks
This works around some issues that have been observed on a specific
Windows computer.

Issue: https://github.com/pybricks/support/issues/256
2021-05-16 16:18:34 -05:00
David Lechner ec6753c314 yarn lint
rules seem to have changed a bit after upgrading packages
2021-05-11 12:45:43 -05:00
David Lechner 2955fe1f24 add tests for lwp3-bootloader reducers 2021-02-01 10:26:06 -06:00
David Lechner e5073399a0 drop explicit state interfaces
This could cause subtle bugs like the one fixed here where license
was renamed to licenses.
2021-02-01 10:26:05 -06:00
David Lechner 0c20e52a45 don't allow optional args in actions
This can lead to subtle bugs.

Fixes firmware flash button not working.
2021-02-01 10:26:05 -06:00
David Lechner 6f204a65f6 reorganize src/ directory
Makes for much less scrolling/jumping around.

https://redux.js.org/style-guide/style-guide#structure-files-as-feature-folders-or-ducks
2021-02-01 10:26:05 -06:00