Improve getHistory types and make ignoreNull optional

This commit is contained in:
Dominic Griesel
2019-02-18 19:47:57 +01:00
parent 72a3259557
commit 73f602e451
2 changed files with 5 additions and 2 deletions

View File

@@ -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 {

View File

@@ -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;