From 3ed10ad8937ac8cb6e3256889989a2a11d3b2c8d Mon Sep 17 00:00:00 2001 From: Emma Segal-Grossman Date: Mon, 12 Feb 2024 19:33:16 -0500 Subject: [PATCH] Add comments I meant to add in #1528 (#1529) Tessa merged #1528 before I got to add these comments lol (it's my fault, should have left the PR as draft until I was actually ready) --- frontend/src/types/org.ts | 26 ++++++-------------------- frontend/src/types/utils.ts | 1 + 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/frontend/src/types/org.ts b/frontend/src/types/org.ts index 45c6e5ff..890ab5c0 100644 --- a/frontend/src/types/org.ts +++ b/frontend/src/types/org.ts @@ -10,6 +10,7 @@ export const AccessCode: Record = { owner: 40, } as const; +/** `${4-digit year}-${2-digit month}` */ export type YearMonth = `${number}-${Range<0, 2>}${Range<0, 10>}`; export type OrgData = { @@ -18,26 +19,11 @@ export type OrgData = { slug: string; quotas?: Record; bytesStored: number; - usage: { - // Keyed by {4-digit year}-{2-digit month} - [key: YearMonth]: number; - } | null; - crawlExecSeconds?: { - // Keyed by {4-digit year}-{2-digit month} - [key: YearMonth]: number; - }; - monthlyExecSeconds?: { - // Keyed by {4-digit year}-{2-digit month} - [key: YearMonth]: number; - }; - extraExecSeconds?: { - // Keyed by {4-digit year}-{2-digit month} - [key: YearMonth]: number; - }; - giftedExecSeconds?: { - // Keyed by {4-digit year}-{2-digit month} - [key: YearMonth]: number; - }; + usage: { [key: YearMonth]: number } | null; + crawlExecSeconds?: { [key: YearMonth]: number }; + monthlyExecSeconds?: { [key: YearMonth]: number }; + extraExecSeconds?: { [key: YearMonth]: number }; + giftedExecSeconds?: { [key: YearMonth]: number }; extraExecSecondsAvailable: number; giftedExecSecondsAvailable: number; storageQuotaReached?: boolean; diff --git a/frontend/src/types/utils.ts b/frontend/src/types/utils.ts index 6a146b99..35df30e3 100644 --- a/frontend/src/types/utils.ts +++ b/frontend/src/types/utils.ts @@ -16,6 +16,7 @@ type Enumerate< ? Acc[number] : Enumerate; +/** Number literal range from `F` to `T` (exclusive) */ export type Range = Exclude< Enumerate, Enumerate