From 31c3e603ed2f13d80cb6150b000e09b05601d658 Mon Sep 17 00:00:00 2001 From: Alex Christoffer Rasmussen Date: Fri, 26 Sep 2025 19:01:07 +0200 Subject: [PATCH] refactor: better type for api aux action (#1796) --- packages/types/src/api/websocket/api.type.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/types/src/api/websocket/api.type.ts b/packages/types/src/api/websocket/api.type.ts index c8c247535..a165e8c77 100644 --- a/packages/types/src/api/websocket/api.type.ts +++ b/packages/types/src/api/websocket/api.type.ts @@ -108,12 +108,15 @@ export type AddtimeResponse = { export type AuxtimerAction = { tag: 'auxtimer'; payload: - | { '1': SimplePlayback } - | { '1': { duration?: number; addtime?: number; direction?: SimpleDirection } } - | { '2': SimplePlayback } - | { '2': { duration?: number; addtime?: number; direction?: SimpleDirection } } - | { '3': SimplePlayback } - | { '3': { duration?: number; addtime?: number; direction?: SimpleDirection } }; + | { + ['1']?: SimplePlayback | { duration?: number; addtime?: number; direction?: SimpleDirection }; + } + | { + ['2']?: SimplePlayback | { duration?: number; addtime?: number; direction?: SimpleDirection }; + } + | { + ['3']?: SimplePlayback | { duration?: number; addtime?: number; direction?: SimpleDirection }; + }; }; export type AuxtimerResponse = { @@ -155,7 +158,7 @@ export type ApiAction = | ClientAction | OffsetmodeAction; - export type ApiResponse = +export type ApiResponse = | VersionResponse | PollResponse | ChangeResponse