@evolu/common 8.1.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/Function.d.ts +1 -0
- package/dist/src/Function.d.ts.map +1 -1
- package/dist/src/Http.d.ts +9 -0
- package/dist/src/Http.d.ts.map +1 -1
- package/dist/src/Number.d.ts +66 -6
- package/dist/src/Number.d.ts.map +1 -1
- package/dist/src/Number.js +11 -3
- package/dist/src/Object.d.ts +1 -0
- package/dist/src/Object.d.ts.map +1 -1
- package/dist/src/RefCount.d.ts +1 -0
- package/dist/src/RefCount.d.ts.map +1 -1
- package/dist/src/Relation.d.ts +2 -0
- package/dist/src/Relation.d.ts.map +1 -1
- package/dist/src/Resource.d.ts +1 -0
- package/dist/src/Resource.d.ts.map +1 -1
- package/dist/src/Result.d.ts +383 -548
- package/dist/src/Result.d.ts.map +1 -1
- package/dist/src/Result.js +296 -46
- package/dist/src/Schedule.d.ts +2 -2
- package/dist/src/Schedule.d.ts.map +1 -1
- package/dist/src/StackTrace.d.ts +1 -0
- package/dist/src/StackTrace.d.ts.map +1 -1
- package/dist/src/Task.d.ts +978 -1061
- package/dist/src/Task.d.ts.map +1 -1
- package/dist/src/Task.js +1010 -159
- package/dist/src/Time.d.ts +71 -34
- package/dist/src/Time.d.ts.map +1 -1
- package/dist/src/Time.js +77 -1
- package/dist/src/Type.d.ts +1740 -795
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +1634 -211
- package/dist/src/Types.d.ts +0 -24
- package/dist/src/Types.d.ts.map +1 -1
- package/dist/src/intl/_en.d.ts +126 -0
- package/dist/src/intl/_en.d.ts.map +1 -0
- package/dist/src/intl/_en.js +267 -0
- package/dist/src/intl/ar.d.ts +117 -0
- package/dist/src/intl/ar.d.ts.map +1 -0
- package/dist/src/intl/ar.js +245 -0
- package/dist/src/intl/bn.d.ts +117 -0
- package/dist/src/intl/bn.d.ts.map +1 -0
- package/dist/src/intl/bn.js +258 -0
- package/dist/src/intl/ca.d.ts +117 -0
- package/dist/src/intl/ca.d.ts.map +1 -0
- package/dist/src/intl/ca.js +258 -0
- package/dist/src/intl/cs.d.ts +30 -7
- package/dist/src/intl/cs.d.ts.map +1 -1
- package/dist/src/intl/cs.js +65 -28
- package/dist/src/intl/da.d.ts +117 -0
- package/dist/src/intl/da.d.ts.map +1 -0
- package/dist/src/intl/da.js +258 -0
- package/dist/src/intl/de.d.ts +117 -0
- package/dist/src/intl/de.d.ts.map +1 -0
- package/dist/src/intl/de.js +258 -0
- package/dist/src/intl/el.d.ts +117 -0
- package/dist/src/intl/el.d.ts.map +1 -0
- package/dist/src/intl/el.js +265 -0
- package/dist/src/intl/es.d.ts +117 -0
- package/dist/src/intl/es.d.ts.map +1 -0
- package/dist/src/intl/es.js +258 -0
- package/dist/src/intl/fa.d.ts +117 -0
- package/dist/src/intl/fa.d.ts.map +1 -0
- package/dist/src/intl/fa.js +258 -0
- package/dist/src/intl/fi.d.ts +117 -0
- package/dist/src/intl/fi.d.ts.map +1 -0
- package/dist/src/intl/fi.js +258 -0
- package/dist/src/intl/fil.d.ts +117 -0
- package/dist/src/intl/fil.d.ts.map +1 -0
- package/dist/src/intl/fil.js +258 -0
- package/dist/src/intl/fr.d.ts +117 -0
- package/dist/src/intl/fr.d.ts.map +1 -0
- package/dist/src/intl/fr.js +258 -0
- package/dist/src/intl/he.d.ts +117 -0
- package/dist/src/intl/he.d.ts.map +1 -0
- package/dist/src/intl/he.js +258 -0
- package/dist/src/intl/hi.d.ts +117 -0
- package/dist/src/intl/hi.d.ts.map +1 -0
- package/dist/src/intl/hi.js +258 -0
- package/dist/src/intl/hr.d.ts +117 -0
- package/dist/src/intl/hr.d.ts.map +1 -0
- package/dist/src/intl/hr.js +265 -0
- package/dist/src/intl/hu.d.ts +63 -0
- package/dist/src/intl/hu.d.ts.map +1 -0
- package/dist/src/intl/hu.js +204 -0
- package/dist/src/intl/id.d.ts +117 -0
- package/dist/src/intl/id.d.ts.map +1 -0
- package/dist/src/intl/id.js +258 -0
- package/dist/src/intl/index.d.ts +42 -0
- package/dist/src/intl/index.d.ts.map +1 -1
- package/dist/src/intl/index.js +42 -0
- package/dist/src/intl/it.d.ts +117 -0
- package/dist/src/intl/it.d.ts.map +1 -0
- package/dist/src/intl/it.js +258 -0
- package/dist/src/intl/ja.d.ts +117 -0
- package/dist/src/intl/ja.d.ts.map +1 -0
- package/dist/src/intl/ja.js +258 -0
- package/dist/src/intl/ko.d.ts +117 -0
- package/dist/src/intl/ko.d.ts.map +1 -0
- package/dist/src/intl/ko.js +258 -0
- package/dist/src/intl/ml.d.ts +117 -0
- package/dist/src/intl/ml.d.ts.map +1 -0
- package/dist/src/intl/ml.js +258 -0
- package/dist/src/intl/mr.d.ts +117 -0
- package/dist/src/intl/mr.d.ts.map +1 -0
- package/dist/src/intl/mr.js +258 -0
- package/dist/src/intl/ms.d.ts +117 -0
- package/dist/src/intl/ms.d.ts.map +1 -0
- package/dist/src/intl/ms.js +245 -0
- package/dist/src/intl/nb.d.ts +63 -0
- package/dist/src/intl/nb.d.ts.map +1 -0
- package/dist/src/intl/nb.js +191 -0
- package/dist/src/intl/nl.d.ts +117 -0
- package/dist/src/intl/nl.d.ts.map +1 -0
- package/dist/src/intl/nl.js +258 -0
- package/dist/src/intl/pa.d.ts +117 -0
- package/dist/src/intl/pa.d.ts.map +1 -0
- package/dist/src/intl/pa.js +258 -0
- package/dist/src/intl/pl.d.ts +117 -0
- package/dist/src/intl/pl.d.ts.map +1 -0
- package/dist/src/intl/pl.js +242 -0
- package/dist/src/intl/pt-BR.d.ts +117 -0
- package/dist/src/intl/pt-BR.d.ts.map +1 -0
- package/dist/src/intl/pt-BR.js +258 -0
- package/dist/src/intl/pt.d.ts +117 -0
- package/dist/src/intl/pt.d.ts.map +1 -0
- package/dist/src/intl/pt.js +246 -0
- package/dist/src/intl/ro.d.ts +117 -0
- package/dist/src/intl/ro.d.ts.map +1 -0
- package/dist/src/intl/ro.js +258 -0
- package/dist/src/intl/sk.d.ts +117 -0
- package/dist/src/intl/sk.d.ts.map +1 -0
- package/dist/src/intl/sk.js +244 -0
- package/dist/src/intl/sl.d.ts +117 -0
- package/dist/src/intl/sl.d.ts.map +1 -0
- package/dist/src/intl/sl.js +258 -0
- package/dist/src/intl/sv.d.ts +117 -0
- package/dist/src/intl/sv.d.ts.map +1 -0
- package/dist/src/intl/sv.js +258 -0
- package/dist/src/intl/sw.d.ts +63 -0
- package/dist/src/intl/sw.d.ts.map +1 -0
- package/dist/src/intl/sw.js +191 -0
- package/dist/src/intl/ta.d.ts +117 -0
- package/dist/src/intl/ta.d.ts.map +1 -0
- package/dist/src/intl/ta.js +258 -0
- package/dist/src/intl/te.d.ts +117 -0
- package/dist/src/intl/te.d.ts.map +1 -0
- package/dist/src/intl/te.js +258 -0
- package/dist/src/intl/th.d.ts +117 -0
- package/dist/src/intl/th.d.ts.map +1 -0
- package/dist/src/intl/th.js +258 -0
- package/dist/src/intl/tr.d.ts +117 -0
- package/dist/src/intl/tr.d.ts.map +1 -0
- package/dist/src/intl/tr.js +255 -0
- package/dist/src/intl/uk.d.ts +117 -0
- package/dist/src/intl/uk.d.ts.map +1 -0
- package/dist/src/intl/uk.js +258 -0
- package/dist/src/intl/ur.d.ts +117 -0
- package/dist/src/intl/ur.d.ts.map +1 -0
- package/dist/src/intl/ur.js +245 -0
- package/dist/src/intl/vi.d.ts +117 -0
- package/dist/src/intl/vi.d.ts.map +1 -0
- package/dist/src/intl/vi.js +255 -0
- package/dist/src/intl/zh-CN.d.ts +117 -0
- package/dist/src/intl/zh-CN.d.ts.map +1 -0
- package/dist/src/intl/zh-CN.js +258 -0
- package/dist/src/intl/zh-TW.d.ts +117 -0
- package/dist/src/intl/zh-TW.d.ts.map +1 -0
- package/dist/src/intl/zh-TW.js +258 -0
- package/dist/src/local-first/Owner.d.ts +156 -62
- package/dist/src/local-first/Owner.d.ts.map +1 -1
- package/dist/src/local-first/Owner.js +119 -20
- package/package.json +1 -1
- package/src/Function.ts +2 -0
- package/src/Http.ts +9 -0
- package/src/Number.ts +85 -14
- package/src/Object.ts +2 -0
- package/src/RefCount.ts +2 -0
- package/src/Relation.ts +4 -0
- package/src/Resource.ts +2 -0
- package/src/Result.ts +397 -560
- package/src/Schedule.ts +1 -1
- package/src/StackTrace.ts +2 -0
- package/src/Task.ts +1145 -1225
- package/src/Time.ts +110 -62
- package/src/Type.ts +2842 -835
- package/src/Types.ts +0 -49
- package/src/intl/_en.ts +497 -0
- package/src/intl/ar.ts +417 -0
- package/src/intl/bn.ts +486 -0
- package/src/intl/ca.ts +488 -0
- package/src/intl/cs.ts +131 -32
- package/src/intl/da.ts +488 -0
- package/src/intl/de.ts +488 -0
- package/src/intl/el.ts +494 -0
- package/src/intl/es.ts +488 -0
- package/src/intl/fa.ts +487 -0
- package/src/intl/fi.ts +487 -0
- package/src/intl/fil.ts +488 -0
- package/src/intl/fr.ts +488 -0
- package/src/intl/he.ts +486 -0
- package/src/intl/hi.ts +487 -0
- package/src/intl/hr.ts +494 -0
- package/src/intl/hu.ts +387 -0
- package/src/intl/id.ts +487 -0
- package/src/intl/index.ts +42 -0
- package/src/intl/it.ts +488 -0
- package/src/intl/ja.ts +488 -0
- package/src/intl/ko.ts +487 -0
- package/src/intl/ml.ts +487 -0
- package/src/intl/mr.ts +487 -0
- package/src/intl/ms.ts +410 -0
- package/src/intl/nb.ts +364 -0
- package/src/intl/nl.ts +488 -0
- package/src/intl/pa.ts +487 -0
- package/src/intl/pl.ts +450 -0
- package/src/intl/pt-BR.ts +487 -0
- package/src/intl/pt.ts +424 -0
- package/src/intl/ro.ts +488 -0
- package/src/intl/sk.ts +412 -0
- package/src/intl/sl.ts +487 -0
- package/src/intl/sv.ts +488 -0
- package/src/intl/sw.ts +324 -0
- package/src/intl/ta.ts +487 -0
- package/src/intl/te.ts +487 -0
- package/src/intl/th.ts +484 -0
- package/src/intl/tr.ts +487 -0
- package/src/intl/uk.ts +488 -0
- package/src/intl/ur.ts +410 -0
- package/src/intl/vi.ts +435 -0
- package/src/intl/zh-CN.ts +482 -0
- package/src/intl/zh-TW.ts +482 -0
- package/src/local-first/Owner.ts +156 -62
package/dist/src/Time.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Brand } from "./Brand.ts";
|
|
7
7
|
import { type DateIso, type NonNaNNumber } from "./Type.ts";
|
|
8
|
-
import type { Digit, Digit1To23, Digit1To51, Digit1To59, Digit1To6, Digit1To9, Digit1To99 } from "./Types.ts";
|
|
9
8
|
/** Time and timer operations. */
|
|
10
9
|
export interface Time {
|
|
11
10
|
readonly now: {
|
|
@@ -139,73 +138,110 @@ export type PerformanceDuration = number & Brand<"PerformanceDuration">;
|
|
|
139
138
|
*/
|
|
140
139
|
export declare const performanceDurationBetween: (start: PerformanceTime, end: PerformanceTime) => PerformanceDuration;
|
|
141
140
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
141
|
+
* {@link DurationLiteral} or {@link Millis}.
|
|
142
|
+
*
|
|
143
|
+
* Convenience input accepting a human-readable {@link DurationLiteral} or
|
|
144
|
+
* validated milliseconds as {@link Millis}. APIs normalize it to `Millis`.
|
|
145
|
+
*
|
|
146
|
+
* ### Example
|
|
147
|
+
*
|
|
148
|
+
* ```ts
|
|
149
|
+
* import { Millis, spaced } from "@evolu/common";
|
|
150
|
+
*
|
|
151
|
+
* const readableSchedule = spaced("1s");
|
|
152
|
+
* const validatedSchedule = spaced(Millis.orThrow(1000));
|
|
153
|
+
*
|
|
154
|
+
* expectTypeOf(readableSchedule).toEqualTypeOf(validatedSchedule);
|
|
155
|
+
* ```
|
|
144
156
|
*/
|
|
145
157
|
export type Duration = DurationLiteral | Millis;
|
|
146
|
-
/** Positive duration accepted by timer-based APIs. */
|
|
147
|
-
export type PositiveDuration = DurationLiteral | PositiveMillis;
|
|
148
158
|
/**
|
|
149
|
-
*
|
|
159
|
+
* {@link DurationLiteral} or {@link PositiveMillis}.
|
|
150
160
|
*
|
|
151
|
-
*
|
|
161
|
+
* Convenience input accepting a human-readable {@link DurationLiteral} or
|
|
162
|
+
* validated milliseconds as {@link PositiveMillis} for timer-based APIs.
|
|
152
163
|
*
|
|
153
|
-
*
|
|
154
|
-
* - Seconds: `1s`, `59s`, `12.5s` (1-59, 1.1-59.9)
|
|
155
|
-
* - Minutes: `1m`, `59m`, `12.5m` (1-59, 1.1-59.9)
|
|
156
|
-
* - Hours: `1h`, `23h`, `12.5h` (1-23, 1.1-23.9)
|
|
157
|
-
* - Days: `1d`, `6d`, `1.5d` (1-6, 1.1-6.9)
|
|
158
|
-
* - Weeks: `1w`, `51w`, `1.5w` (1-51, 1.1-51.9)
|
|
159
|
-
* - Months: not supported (variable length)
|
|
160
|
-
* - Years: `1y`, `99y`, `1.5y` (1-99, 1.1-99.9)
|
|
161
|
-
*
|
|
162
|
-
* Each unit uses a bounded range. Where units convert exactly, this avoids
|
|
163
|
-
* equivalent representations (e.g., 1000ms must be written as `"1s"`, not
|
|
164
|
-
* `"1000ms"`).
|
|
164
|
+
* ### Example
|
|
165
165
|
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* use {@link Millis} directly.
|
|
166
|
+
* ```ts
|
|
167
|
+
* import { PositiveMillis, sleep } from "@evolu/common";
|
|
169
168
|
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
169
|
+
* const readableSleep = sleep("1s");
|
|
170
|
+
* const validatedSleep = sleep(PositiveMillis.orThrow(1000));
|
|
172
171
|
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
172
|
+
* expectTypeOf(readableSleep).toEqualTypeOf(validatedSleep);
|
|
173
|
+
* ```
|
|
175
174
|
*/
|
|
176
|
-
export type
|
|
175
|
+
export type PositiveDuration = DurationLiteral | PositiveMillis;
|
|
177
176
|
/** Milliseconds duration: `"1ms"` to `"999ms"`. See {@link DurationLiteral}. */
|
|
178
|
-
export
|
|
177
|
+
export declare const DurationLiteralMilliseconds: import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "ms"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "ms"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "ms"]>]>;
|
|
178
|
+
export type DurationLiteralMilliseconds = typeof DurationLiteralMilliseconds.Output;
|
|
179
179
|
/**
|
|
180
180
|
* Seconds duration: `"1s"` to `"59s"` or `"1.1s"` to `"59.9s"`. See
|
|
181
181
|
* {@link DurationLiteral}.
|
|
182
182
|
*/
|
|
183
|
-
export
|
|
183
|
+
export declare const DurationLiteralSeconds: import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, "s"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "s"]>]>;
|
|
184
|
+
export type DurationLiteralSeconds = typeof DurationLiteralSeconds.Output;
|
|
184
185
|
/**
|
|
185
186
|
* Minutes duration: `"1m"` to `"59m"` or `"1.1m"` to `"59.9m"`. See
|
|
186
187
|
* {@link DurationLiteral}.
|
|
187
188
|
*/
|
|
188
|
-
export
|
|
189
|
+
export declare const DurationLiteralMinutes: import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, "m"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "m"]>]>;
|
|
190
|
+
export type DurationLiteralMinutes = typeof DurationLiteralMinutes.Output;
|
|
189
191
|
/**
|
|
190
192
|
* Hours duration: `"1h"` to `"23h"` or `"1.1h"` to `"23.9h"`. See
|
|
191
193
|
* {@link DurationLiteral}.
|
|
192
194
|
*/
|
|
193
|
-
export
|
|
195
|
+
export declare const DurationLiteralHours: import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly ["1", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>, import("./Type.ts").TemplateLiteralType<readonly ["2", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">]>]>]>, "h"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly ["1", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>, import("./Type.ts").TemplateLiteralType<readonly ["2", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">]>]>]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "h"]>]>;
|
|
196
|
+
export type DurationLiteralHours = typeof DurationLiteralHours.Output;
|
|
194
197
|
/**
|
|
195
198
|
* Days duration: `"1d"` to `"6d"` or `"1.1d"` to `"6.9d"`. See
|
|
196
199
|
* {@link DurationLiteral}.
|
|
197
200
|
*/
|
|
198
|
-
export
|
|
201
|
+
export declare const DurationLiteralDays: import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">]>, "d"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "d"]>]>;
|
|
202
|
+
export type DurationLiteralDays = typeof DurationLiteralDays.Output;
|
|
199
203
|
/**
|
|
200
204
|
* Weeks duration: `"1w"` to `"51w"` or `"1.1w"` to `"51.9w"`. See
|
|
201
205
|
* {@link DurationLiteral}.
|
|
202
206
|
*/
|
|
203
|
-
export
|
|
207
|
+
export declare const DurationLiteralWeeks: import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>, import("./Type.ts").TemplateLiteralType<readonly ["5", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">]>]>]>, "w"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>, import("./Type.ts").TemplateLiteralType<readonly ["5", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">]>]>]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "w"]>]>;
|
|
208
|
+
export type DurationLiteralWeeks = typeof DurationLiteralWeeks.Output;
|
|
204
209
|
/**
|
|
205
210
|
* Years duration: `"1y"` to `"99y"` or `"1.1y"` to `"99.9y"`. See
|
|
206
211
|
* {@link DurationLiteral}.
|
|
207
212
|
*/
|
|
208
|
-
export
|
|
213
|
+
export declare const DurationLiteralYears: import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, "y"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "y"]>]>;
|
|
214
|
+
export type DurationLiteralYears = typeof DurationLiteralYears.Output;
|
|
215
|
+
/**
|
|
216
|
+
* Duration literal Type with compile-time and runtime validation.
|
|
217
|
+
*
|
|
218
|
+
* Supported formats:
|
|
219
|
+
*
|
|
220
|
+
* - Milliseconds: `1ms`, `500ms`, `999ms` (1-999)
|
|
221
|
+
* - Seconds: `1s`, `59s`, `12.5s` (1-59, 1.1-59.9)
|
|
222
|
+
* - Minutes: `1m`, `59m`, `12.5m` (1-59, 1.1-59.9)
|
|
223
|
+
* - Hours: `1h`, `23h`, `12.5h` (1-23, 1.1-23.9)
|
|
224
|
+
* - Days: `1d`, `6d`, `1.5d` (1-6, 1.1-6.9)
|
|
225
|
+
* - Weeks: `1w`, `51w`, `1.5w` (1-51, 1.1-51.9)
|
|
226
|
+
* - Months: not supported (variable length)
|
|
227
|
+
* - Years: `1y`, `99y`, `1.5y` (1-99, 1.1-99.9)
|
|
228
|
+
*
|
|
229
|
+
* Each unit uses a bounded range. Where units convert exactly, this avoids
|
|
230
|
+
* equivalent representations (e.g., 1000ms must be written as `"1s"`, not
|
|
231
|
+
* `"1000ms"`).
|
|
232
|
+
*
|
|
233
|
+
* Decimal values cover cases like 1.5s (1500ms) or 1.5h (90 minutes) without
|
|
234
|
+
* allowing redundant forms. For precise values that don't fit (e.g., 1050ms),
|
|
235
|
+
* use {@link Millis} directly.
|
|
236
|
+
*
|
|
237
|
+
* Zero duration (0ms) is not supported. For yielding without delay, use `await
|
|
238
|
+
* Promise.resolve()` for microtasks or the {@link yieldNow} for macrotasks.
|
|
239
|
+
*
|
|
240
|
+
* See {@link Duration} for a type that also accepts {@link Millis}. Use
|
|
241
|
+
* {@link durationToMillis} to convert to milliseconds.
|
|
242
|
+
*/
|
|
243
|
+
export declare const DurationLiteral: import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "ms"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "ms"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "ms"]>]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, "s"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "s"]>]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, "m"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "m"]>]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly ["1", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>, import("./Type.ts").TemplateLiteralType<readonly ["2", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">]>]>]>, "h"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly ["1", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>, import("./Type.ts").TemplateLiteralType<readonly ["2", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">]>]>]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "h"]>]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">]>, "d"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "d"]>]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>, import("./Type.ts").TemplateLiteralType<readonly ["5", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">]>]>]>, "w"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>, import("./Type.ts").TemplateLiteralType<readonly ["5", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">]>]>]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "w"]>]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, "y"]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").TemplateLiteralType<readonly [import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"0">, import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>]>]>, ".", import("./Type.ts").UnionType<readonly [import("./Type.ts").LiteralType<"1">, import("./Type.ts").LiteralType<"2">, import("./Type.ts").LiteralType<"3">, import("./Type.ts").LiteralType<"4">, import("./Type.ts").LiteralType<"5">, import("./Type.ts").LiteralType<"6">, import("./Type.ts").LiteralType<"7">, import("./Type.ts").LiteralType<"8">, import("./Type.ts").LiteralType<"9">]>, "y"]>]>]>;
|
|
244
|
+
export type DurationLiteral = typeof DurationLiteral.Output;
|
|
209
245
|
/**
|
|
210
246
|
* Converts a duration to milliseconds.
|
|
211
247
|
*
|
|
@@ -225,6 +261,7 @@ export type DurationLiteralYears = `${Digit1To99}y` | `${Digit1To99}.${Digit1To9
|
|
|
225
261
|
* ```
|
|
226
262
|
*/
|
|
227
263
|
export declare function durationToMillis(duration: DurationLiteral | PositiveMillis): PositiveMillis;
|
|
264
|
+
/** Converts a general {@link Duration}, including zero, to milliseconds. */
|
|
228
265
|
export declare function durationToMillis(duration: Duration): Millis;
|
|
229
266
|
/**
|
|
230
267
|
* Frame budget at 60fps (16ms).
|
package/dist/src/Time.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Time.d.ts","sourceRoot":"","sources":["../../src/Time.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAEL,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"Time.d.ts","sourceRoot":"","sources":["../../src/Time.ts"],"names":[],"mappings":"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"}
|
package/dist/src/Time.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { assert } from "./Assert.js";
|
|
7
|
-
import { brand, lessThan, NonNegativeInt, positive, } from "./Type.js";
|
|
7
|
+
import { brand, Digit, Digit1To23, Digit1To51, Digit1To59, Digit1To6, Digit1To9, Digit1To99, lessThan, NonNegativeInt, positive, templateLiteral, union, } from "./Type.js";
|
|
8
8
|
/**
|
|
9
9
|
* Creates a {@link Time} using `Date.now()`, `performance`, and
|
|
10
10
|
* `globalThis.setTimeout`.
|
|
@@ -215,6 +215,82 @@ export const performanceDurationBetween = (start, end) => {
|
|
|
215
215
|
assert(end >= start, "Performance end time must not precede start time");
|
|
216
216
|
return (end - start);
|
|
217
217
|
};
|
|
218
|
+
/** Milliseconds duration: `"1ms"` to `"999ms"`. See {@link DurationLiteral}. */
|
|
219
|
+
export const DurationLiteralMilliseconds = /*#__PURE__*/ union(
|
|
220
|
+
/*#__PURE__*/ templateLiteral(Digit1To9, "ms"),
|
|
221
|
+
/*#__PURE__*/ templateLiteral(Digit1To9, Digit, "ms"),
|
|
222
|
+
/*#__PURE__*/ templateLiteral(Digit1To9, Digit, Digit, "ms"));
|
|
223
|
+
/**
|
|
224
|
+
* Seconds duration: `"1s"` to `"59s"` or `"1.1s"` to `"59.9s"`. See
|
|
225
|
+
* {@link DurationLiteral}.
|
|
226
|
+
*/
|
|
227
|
+
export const DurationLiteralSeconds = /*#__PURE__*/ union(
|
|
228
|
+
/*#__PURE__*/ templateLiteral(Digit1To59, "s"),
|
|
229
|
+
/*#__PURE__*/ templateLiteral(Digit1To59, ".", Digit1To9, "s"));
|
|
230
|
+
/**
|
|
231
|
+
* Minutes duration: `"1m"` to `"59m"` or `"1.1m"` to `"59.9m"`. See
|
|
232
|
+
* {@link DurationLiteral}.
|
|
233
|
+
*/
|
|
234
|
+
export const DurationLiteralMinutes = /*#__PURE__*/ union(
|
|
235
|
+
/*#__PURE__*/ templateLiteral(Digit1To59, "m"),
|
|
236
|
+
/*#__PURE__*/ templateLiteral(Digit1To59, ".", Digit1To9, "m"));
|
|
237
|
+
/**
|
|
238
|
+
* Hours duration: `"1h"` to `"23h"` or `"1.1h"` to `"23.9h"`. See
|
|
239
|
+
* {@link DurationLiteral}.
|
|
240
|
+
*/
|
|
241
|
+
export const DurationLiteralHours = /*#__PURE__*/ union(
|
|
242
|
+
/*#__PURE__*/ templateLiteral(Digit1To23, "h"),
|
|
243
|
+
/*#__PURE__*/ templateLiteral(Digit1To23, ".", Digit1To9, "h"));
|
|
244
|
+
/**
|
|
245
|
+
* Days duration: `"1d"` to `"6d"` or `"1.1d"` to `"6.9d"`. See
|
|
246
|
+
* {@link DurationLiteral}.
|
|
247
|
+
*/
|
|
248
|
+
export const DurationLiteralDays = /*#__PURE__*/ union(
|
|
249
|
+
/*#__PURE__*/ templateLiteral(Digit1To6, "d"),
|
|
250
|
+
/*#__PURE__*/ templateLiteral(Digit1To6, ".", Digit1To9, "d"));
|
|
251
|
+
/**
|
|
252
|
+
* Weeks duration: `"1w"` to `"51w"` or `"1.1w"` to `"51.9w"`. See
|
|
253
|
+
* {@link DurationLiteral}.
|
|
254
|
+
*/
|
|
255
|
+
export const DurationLiteralWeeks = /*#__PURE__*/ union(
|
|
256
|
+
/*#__PURE__*/ templateLiteral(Digit1To51, "w"),
|
|
257
|
+
/*#__PURE__*/ templateLiteral(Digit1To51, ".", Digit1To9, "w"));
|
|
258
|
+
/**
|
|
259
|
+
* Years duration: `"1y"` to `"99y"` or `"1.1y"` to `"99.9y"`. See
|
|
260
|
+
* {@link DurationLiteral}.
|
|
261
|
+
*/
|
|
262
|
+
export const DurationLiteralYears = /*#__PURE__*/ union(
|
|
263
|
+
/*#__PURE__*/ templateLiteral(Digit1To99, "y"),
|
|
264
|
+
/*#__PURE__*/ templateLiteral(Digit1To99, ".", Digit1To9, "y"));
|
|
265
|
+
/**
|
|
266
|
+
* Duration literal Type with compile-time and runtime validation.
|
|
267
|
+
*
|
|
268
|
+
* Supported formats:
|
|
269
|
+
*
|
|
270
|
+
* - Milliseconds: `1ms`, `500ms`, `999ms` (1-999)
|
|
271
|
+
* - Seconds: `1s`, `59s`, `12.5s` (1-59, 1.1-59.9)
|
|
272
|
+
* - Minutes: `1m`, `59m`, `12.5m` (1-59, 1.1-59.9)
|
|
273
|
+
* - Hours: `1h`, `23h`, `12.5h` (1-23, 1.1-23.9)
|
|
274
|
+
* - Days: `1d`, `6d`, `1.5d` (1-6, 1.1-6.9)
|
|
275
|
+
* - Weeks: `1w`, `51w`, `1.5w` (1-51, 1.1-51.9)
|
|
276
|
+
* - Months: not supported (variable length)
|
|
277
|
+
* - Years: `1y`, `99y`, `1.5y` (1-99, 1.1-99.9)
|
|
278
|
+
*
|
|
279
|
+
* Each unit uses a bounded range. Where units convert exactly, this avoids
|
|
280
|
+
* equivalent representations (e.g., 1000ms must be written as `"1s"`, not
|
|
281
|
+
* `"1000ms"`).
|
|
282
|
+
*
|
|
283
|
+
* Decimal values cover cases like 1.5s (1500ms) or 1.5h (90 minutes) without
|
|
284
|
+
* allowing redundant forms. For precise values that don't fit (e.g., 1050ms),
|
|
285
|
+
* use {@link Millis} directly.
|
|
286
|
+
*
|
|
287
|
+
* Zero duration (0ms) is not supported. For yielding without delay, use `await
|
|
288
|
+
* Promise.resolve()` for microtasks or the {@link yieldNow} for macrotasks.
|
|
289
|
+
*
|
|
290
|
+
* See {@link Duration} for a type that also accepts {@link Millis}. Use
|
|
291
|
+
* {@link durationToMillis} to convert to milliseconds.
|
|
292
|
+
*/
|
|
293
|
+
export const DurationLiteral = /*#__PURE__*/ union(DurationLiteralMilliseconds, DurationLiteralSeconds, DurationLiteralMinutes, DurationLiteralHours, DurationLiteralDays, DurationLiteralWeeks, DurationLiteralYears);
|
|
218
294
|
export function durationToMillis(duration) {
|
|
219
295
|
if (typeof duration === "number")
|
|
220
296
|
return duration;
|