-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.d.ts
More file actions
129 lines (109 loc) · 2.75 KB
/
types.d.ts
File metadata and controls
129 lines (109 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
type Stringified<T> = { [P in keyof T]: string };
type AppPage = "category" | "calendar" | "limits" | "settings";
interface AppMigration {
version: number;
updatedTime: number;
}
interface AppCategory {
categoryId: number;
name: string;
color: string;
}
interface AppEvent {
eventId: number;
categoryId: number;
startDate: number;
stopDate: number;
note: string;
}
interface AppLimit {
limitId: number;
categoryId: number;
name: string;
maxDays: number;
isFavorite: number;
intervalType: "fixed" | "running" | "custom";
fixedInterval: "yearly" | "monthly" | null;
runningAmount: number | null;
runningUnit: "year" | "month" | "day" | null;
customStartDate: number | null;
customStopDate: number | null;
}
interface Array<T> {
groupBy<K extends keyof T>(key: K): Record<string, Omit<T, K>[]>;
toObject<K extends keyof T>(key: K): Record<string, T>;
}
interface DateConstructor {
DAY_IN_MS: number;
/**
* Returns date.now() rounded down to day granularity.
*/
today(): number;
/**
* Generates a range from `start` to `stop` with the given `step` size.
* @param start Start of the range.
* @param stop Stop of the range (non-inclusive depending on the `step`).
* @param step The step size, defaulting to one full day.
*/
range(
start: number,
stop: number,
step?: number
): Generator<number, void, unknown>;
/**
* Modifies an ISO date string by adding and subtracting `-` symbols.
*
* @param prev Previous string value
* @param now Current string value
*/
onChangeFormat(prev: string, now: string): string;
}
interface Date {
/**
* Returns the object representation of a date
*/
getComponents(): { year: number; month: number; day: number };
/**
* getUTCDay returns 0 to 6 representing Sunday to Saturday
*
* getISODay returns 1 to 7 representing Monday to Sunday
*/
getISODay(): number;
/**
* Returns the date part of an ISO string
*
* @Example "2022-02-28"
*/
toISODateString(): string;
/**
* Returns the month part of an ISO string
*
* @Example "2022-02"
*/
toISOMonthString(): string;
/**
* Returns the year part of an ISO string
*
* @Example "2022"
*/
toISOYearString(): string;
/**
* Returns a new Date after adding the given years, months and days.
*/
add({ years: number = 0, months: number = 0, days: number = 0 }): Date;
/**
* Returns a new Date with date of month equal to 1
*/
floor(): Date;
/**
* Returns a new Date with date of month equal to last of month
*/
ceil(): Date;
}
interface Object {
map<T, R>(
o: T,
callbackfn: (value: T[keyof T], index: number) => R
): { [P in keyof T]: R };
}