exstats.d.ts: permit optional notify input, but non-optional on `ex.state.notify`

pull/3565/head
Rob Pilling 2024-10-10 18:01:12 +01:00
parent 23a53f0284
commit 3ef013d002
1 changed files with 13 additions and 5 deletions

View File

@ -10,17 +10,25 @@ declare module ExStats {
type Options<Ids> = { type Options<Ids> = {
paceLength?: number, paceLength?: number,
notify?: Notify<Ids>, notify?: NotifyInput<Ids>,
}; };
type Notify<Ids> = { type Notify<Ids> = {
[key in Ids & ("dist" | "step" | "time")]?: { [key in Ids & ("dist" | "step" | "time")]: {
// optional when passed in ^ increment: number,
increment?: number, next: number,
next?: number,
} }
}; };
type NotifyInput<Ids> = {
[K in keyof Notify<Ids>]?:
Omit<
Notify<Ids>[K], "next"
> & {
next?: number,
};
};
type StatsInst<Ids extends StatsId> = { type StatsInst<Ids extends StatsId> = {
stats: Stats<Ids>, stats: Stats<Ids>,
state: State<Ids>, state: State<Ids>,