From 73f602e451cb6ccfba85fcb3e14ea73a6120e726 Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Mon, 18 Feb 2019 19:47:57 +0100 Subject: [PATCH] Improve getHistory types and make ignoreNull optional --- types/iobroker/index.d.ts | 5 +++-- types/iobroker/iobroker-tests.ts | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/iobroker/index.d.ts b/types/iobroker/index.d.ts index 71fa1b4d78..846a59ef2d 100644 --- a/types/iobroker/index.d.ts +++ b/types/iobroker/index.d.ts @@ -900,7 +900,7 @@ declare global { q?: boolean; addID?: boolean; limit?: number; - ignoreNull: boolean; + ignoreNull?: boolean; sessionId?: any; aggregate?: "minmax" | "min" | "max" | "average" | "total" | "count" | "none"; } @@ -1682,7 +1682,8 @@ declare global { type SetStateCallback = (err: string | null, id?: string) => void; type SetStateChangedCallback = (err: string | null, id: string, notChanged: boolean) => void; type DeleteStateCallback = (err: string | null, id?: string) => void; - type GetHistoryCallback = (err: string | null, result: Array<(State & { id?: string })>, step: number, sessionId?: string) => void; + type GetHistoryResult = Array<(State & { id?: string })> + type GetHistoryCallback = (err: string | null, result: GetHistoryResult, step: number, sessionId?: string) => void; /** Contains the return values of readDir */ interface ReadDirResult { diff --git a/types/iobroker/iobroker-tests.ts b/types/iobroker/iobroker-tests.ts index 0302a5041a..ef59085e67 100644 --- a/types/iobroker/iobroker-tests.ts +++ b/types/iobroker/iobroker-tests.ts @@ -260,6 +260,8 @@ adapter.subscribeForeignStatesAsync("*").catch(handleError); adapter.unsubscribeStatesAsync("*").catch(handleError); adapter.unsubscribeForeignStatesAsync("*").catch(handleError); +adapter.getHistory("state.id", {}, (err, result: ioBroker.GetHistoryResult) => {}); + // Repro from https://github.com/ioBroker/adapter-core/issues/3 const repro1: ioBroker.ObjectChangeHandler = (id, obj) => { if (!obj || !obj.common) return;