declare module ExStats { type StatsId = "time" | "dist" | "step" | "bpm" | "maxbpm" | "pacea" | "pacec" | "speed" | "caden" | "altg" | "altb"; function getList(): { name: string, id: StatsId }[]; function getStats( ids: Ids[], options?: Options ): StatsInst; type Options = { paceLength?: number, notify?: NotifyInput, }; type Notify = { [key in Ids & ("dist" | "step" | "time")]: { increment: number, next: number, } }; type NotifyInput = { [K in keyof Notify]?: Omit< Notify[K], "next" > & { next?: number, }; }; type StatsInst = { stats: Stats, state: State, start(): void, stop(): void, resume(): void, }; type State = { notify: Notify, active: boolean, duration: number, startTime: number, lastTime: number, BPM: number, BPMage: number, maxBPM: number, alt: number | undefined, alti: number, avrSpeed: number, curSpeed: number, distance: number, startSteps: number, lastSteps: number, stepHistory: Uint8Array, stepsPerMin: number, thisGPS: GPSFix | {}, lastGPS: GPSFix | {}, }; type Stats = { [key in Ids]: Stat }; type Stat = { title: string, getValue(): number, getString(): string, id: StatsId, on(what: "changed", cb: (stat: Stat) => void): void; // emitted by dist|step|time on(what: "notify", cb: (stat: Stat) => void): void; }; }