Skip to content

Commit 48a2162

Browse files
committed
Expose PartialDateString type
1 parent 4147f08 commit 48a2162

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alveusgg/data",
3-
"version": "0.17.3",
3+
"version": "0.17.4",
44
"private": true,
55
"license": "SEE LICENSE IN LICENSE.md",
66
"repository": {

src/ambassadors/core.ts

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
import type { IUCNStatus } from "../iucn";
22
import type { EnclosureKey } from "../enclosures";
3+
import type { PartialDateString, Nullable } from "../types";
34
import { Class } from "./classification";
45

5-
type OneToNine = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
6-
type ZeroToNine = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
7-
type DateStringYear =
8-
| `19${ZeroToNine}${ZeroToNine}`
9-
| `20${ZeroToNine}${ZeroToNine}`;
10-
type DateStringMonth = `0${OneToNine}` | `1${0 | 1 | 2}`;
11-
type DateStringYearMonth = `${DateStringYear}-${DateStringMonth}`;
12-
type DateStringDay = `${0}${OneToNine}` | `${1 | 2}${ZeroToNine}` | `3${0 | 1}`;
13-
type DateString = `${DateStringYearMonth}-${DateStringDay}`;
14-
type PartialDateString = DateStringYear | DateStringYearMonth | DateString;
15-
16-
type Nullable<T> = T | null;
17-
186
export type Ambassadors = typeof ambassadors;
197

208
export type AmbassadorKey = keyof Ambassadors;

src/types.d.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
type OneToNine = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
2+
type ZeroToNine = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
3+
type DateStringYear =
4+
| `19${ZeroToNine}${ZeroToNine}`
5+
| `20${ZeroToNine}${ZeroToNine}`;
6+
type DateStringMonth = `0${OneToNine}` | `1${0 | 1 | 2}`;
7+
type DateStringYearMonth = `${DateStringYear}-${DateStringMonth}`;
8+
type DateStringDay = `${0}${OneToNine}` | `${1 | 2}${ZeroToNine}` | `3${0 | 1}`;
9+
type DateString = `${DateStringYearMonth}-${DateStringDay}`;
10+
export type PartialDateString = DateStringYear | DateStringYearMonth | DateString;
11+
12+
export type Nullable<T> = T | null;

0 commit comments

Comments
 (0)