@evolu/common 8.0.0 → 8.2.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/src/Types.ts CHANGED
@@ -381,55 +381,6 @@ export const isPromiseLike = <T>(
381
381
  ): value is PromiseLike<T> =>
382
382
  typeof (value as PromiseLike<T> | null | undefined)?.then === "function";
383
383
 
384
- /** Decimal digit from `"0"` to `"9"`. */
385
- export type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
386
-
387
- /** Decimal digit from `"1"` to `"9"`. */
388
- export type Digit1To9 = Exclude<Digit, "0">;
389
-
390
- /** Decimal string from `"1"` to `"6"`. */
391
- export type Digit1To6 = "1" | "2" | "3" | "4" | "5" | "6";
392
-
393
- /** Decimal string from `"1"` to `"23"`. */
394
- export type Digit1To23 =
395
- | Digit1To9 // 1-9
396
- | `1${Digit}` // 10-19
397
- | `2${"0" | "1" | "2" | "3"}`; // 20-23
398
-
399
- /** Decimal string from `"1"` to `"51"`. */
400
- export type Digit1To51 =
401
- | Digit1To9 // 1-9
402
- | `${"1" | "2" | "3" | "4"}${Digit}` // 10-49
403
- | `5${"0" | "1"}`; // 50-51
404
-
405
- /** Decimal string from `"1"` to `"99"`. */
406
- export type Digit1To99 =
407
- | Digit1To9 // 1-9
408
- | `${Digit1To9}${Digit}`; // 10-99
409
-
410
- /** Decimal string from `"1"` to `"59"`. */
411
- export type Digit1To59 =
412
- | Digit1To9 // 1-9
413
- | `1${Digit}` // 10-19
414
- | `2${Digit}` // 20-29
415
- | `3${Digit}` // 30-39
416
- | `4${Digit}` // 40-49
417
- | `5${Digit}`; // 50-59
418
-
419
- /** Numeric literal 1-99. */
420
- export type Int1To99 = NumberFromString<Digit1To99>;
421
-
422
- /** Numeric literal 1-100. */
423
- export type Int1To100 = Int1To99 | 100;
424
-
425
- /**
426
- * Parses a numeric literal type from a string literal.
427
- *
428
- * Used by {@link Int1To99}.
429
- */
430
- export type NumberFromString<T extends string> =
431
- T extends `${infer N extends number}` ? N : never;
432
-
433
384
  /** Creates a readable compiler-facing error message. */
434
385
  export type CompileTimeError<
435
386
  Context extends string,
package/src/intl/cs.ts CHANGED
@@ -16,6 +16,7 @@ import type {
16
16
  BetweenError,
17
17
  CapitalizedError,
18
18
  DateIsoError,
19
+ DecimalStringError,
19
20
  DiscriminatedUnionError,
20
21
  FiniteError,
21
22
  GreaterThanError,
@@ -32,10 +33,13 @@ import type {
32
33
  MaxLengthError,
33
34
  MinLengthError,
34
35
  MultipleOfError,
36
+ NegativeDecimalStringError,
35
37
  NegativeError,
36
38
  NeverError,
37
39
  NonNaNError,
40
+ NonNegativeDecimalStringError,
38
41
  NonNegativeError,
42
+ NonPositiveDecimalStringError,
39
43
  NonPositiveError,
40
44
  ObjectError,
41
45
  ObjectNotObjectError,
@@ -46,6 +50,7 @@ import type {
46
50
  PositiveError,
47
51
  RecordError,
48
52
  RegexError,
53
+ TemplateLiteralError,
49
54
  TrimmedError,
50
55
  TupleError,
51
56
  TypeErrorFormatter,
@@ -74,6 +79,12 @@ export const formatStringError: TypeErrorFormatter<
74
79
  TypeOfError<"String">
75
80
  > = () => "Hodnota musí být text.";
76
81
 
82
+ /** Formats a TemplateLiteralError in Czech. */
83
+ export const formatTemplateLiteralError: TypeErrorFormatter<
84
+ TemplateLiteralError
85
+ > = (error) =>
86
+ `Hodnota ${safelyStringifyUnknownValue(error.value)} neodpovídá šablonovému řetězci.`;
87
+
77
88
  /** Formats a Number TypeOfError in Czech. */
78
89
  export const formatNumberError: TypeErrorFormatter<TypeOfError<"Number">> = (
79
90
  error,
@@ -123,6 +134,12 @@ export const formatUnionError: TypeErrorFormatter<UnionError> = () =>
123
134
  export const formatDateIsoError: TypeErrorFormatter<DateIsoError> = (error) =>
124
135
  `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být datum a čas v kanonickém formátu ISO.`;
125
136
 
137
+ /** Formats a DecimalStringError in Czech. */
138
+ export const formatDecimalStringError: TypeErrorFormatter<
139
+ DecimalStringError
140
+ > = (error) =>
141
+ `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být kanonický řetězec představující desetinné číslo.`;
142
+
126
143
  /** Formats an Int64Error in Czech. */
127
144
  export const formatInt64Error: TypeErrorFormatter<Int64Error> = (error) =>
128
145
  `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být platné 64bitové celé číslo se znaménkem (Int64).`;
@@ -169,6 +186,12 @@ export const formatNonNegativeError: TypeErrorFormatter<NonNegativeError> = (
169
186
  ) =>
170
187
  `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být nezáporná (>= 0).`;
171
188
 
189
+ /** Formats a NonNegativeDecimalStringError in Czech. */
190
+ export const formatNonNegativeDecimalStringError: TypeErrorFormatter<
191
+ NonNegativeDecimalStringError
192
+ > = (error) =>
193
+ `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být řetězec představující nezáporné desetinné číslo.`;
194
+
172
195
  /** Formats a PositiveError in Czech. */
173
196
  export const formatPositiveError: TypeErrorFormatter<PositiveError> = (error) =>
174
197
  `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být kladná (> 0).`;
@@ -177,7 +200,7 @@ export const formatPositiveError: TypeErrorFormatter<PositiveError> = (error) =>
177
200
  export const formatPositiveDecimalStringError: TypeErrorFormatter<
178
201
  PositiveDecimalStringError
179
202
  > = (error) =>
180
- `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být kanonický řetězec představující kladné desetinné číslo.`;
203
+ `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být řetězec představující kladné desetinné číslo.`;
181
204
 
182
205
  /** Formats a NonPositiveError in Czech. */
183
206
  export const formatNonPositiveError: TypeErrorFormatter<NonPositiveError> = (
@@ -185,10 +208,22 @@ export const formatNonPositiveError: TypeErrorFormatter<NonPositiveError> = (
185
208
  ) =>
186
209
  `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být nekladná (<= 0).`;
187
210
 
211
+ /** Formats a NonPositiveDecimalStringError in Czech. */
212
+ export const formatNonPositiveDecimalStringError: TypeErrorFormatter<
213
+ NonPositiveDecimalStringError
214
+ > = (error) =>
215
+ `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být řetězec představující nekladné desetinné číslo.`;
216
+
188
217
  /** Formats a NegativeError in Czech. */
189
218
  export const formatNegativeError: TypeErrorFormatter<NegativeError> = (error) =>
190
219
  `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být záporná (< 0).`;
191
220
 
221
+ /** Formats a NegativeDecimalStringError in Czech. */
222
+ export const formatNegativeDecimalStringError: TypeErrorFormatter<
223
+ NegativeDecimalStringError
224
+ > = (error) =>
225
+ `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být řetězec představující záporné desetinné číslo.`;
226
+
192
227
  /** Formats an IntError in Czech. */
193
228
  export const formatIntError: TypeErrorFormatter<IntError> = (error) =>
194
229
  `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být bezpečné celé číslo.`;