From b412071523b39c263b2a589b8dcdf31036640552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 10:23:43 -0400 Subject: [PATCH 01/12] remove strongly typed enum-likes; they break discriminated unions --- .../adr/0025-ts-deprecate-enums.md | 125 +++--------------- docs/contributing/code-style/enums.md | 25 +++- 2 files changed, 35 insertions(+), 115 deletions(-) diff --git a/docs/architecture/adr/0025-ts-deprecate-enums.md b/docs/architecture/adr/0025-ts-deprecate-enums.md index 25bf34d2f..d9afe181f 100644 --- a/docs/architecture/adr/0025-ts-deprecate-enums.md +++ b/docs/architecture/adr/0025-ts-deprecate-enums.md @@ -36,42 +36,35 @@ avoids both code generation and type inconsistencies. ```ts // declare the raw data and reduce repetition with an internal type -const _CipherType = { +const CipherType = Object.freeze({ Login: 1, SecureNote: 2, Card: 3, Identity: 4, SshKey: 5, -} as const; - -type _CipherType = typeof _CipherType; +} as const); // derive the enum-like type from the raw data -export type CipherType = _CipherType[keyof _CipherType]; - -// assert that the raw data is of the enum-like type -export const CipherType: Readonly<{ [K in keyof _CipherType]: CipherType }> = - Object.freeze(_CipherType); +export type CipherType = _CipherType[keyof typeof CipherType]; ``` This code creates a `type CipherType` that allows arguments and variables to be typed similarly to -an enum. It also strongly types the `const CiperType` so that direct accesses of its members -preserve type safety. This ensures that type inference properly limits the accepted values to those -allowed by `type CipherType`. Without the type assertion, the compiler infers `number` in these -cases: - -```ts -const s = new Subject(CipherType.Login); // `s` is a `Subject` -const a = [CipherType.Login, CipherType.Card]; // `a` is an `Array` -const m = new Map([[CipherType.Login, ""]]); // `m` is a `Map` -``` +an enum. :::warning -- Types that use enums like [computed property names][computed-property-names] issue a compiler - error with this pattern. [This issue is fixed as of TypeScript 5.8][no-member-fields-fixed]. -- Certain objects are more difficult to create with this pattern. This is explored in - [Appendix A](#appendix-a-mapped-types-and-enum-likes). +Unlike an enum, typescript lifts the type of the members of `const CipherType` to `number`. Code +like the following requires you explicitly type your variables: + +```ts +// ✅ Do: strongly type enum-likes +const subject = new Subject(); +let value: CipherType = CipherType.Login; + +// ❌ Do not: use type inference +const array = [CipherType.Login]; // infers `number[]` +let value = CipherType.Login; // infers `1` +``` ::: @@ -107,92 +100,6 @@ Chosen option: **Deprecate enum use** - Update contributing docs with patterns and best practices for enum replacement. - Update the reporting level of the lint to "warning". -## Appendix A: Mapped Types and Enum-likes - -Mapped types cannot determine that a mapped enum-like object is fully assigned. Code like the -following causes a compiler error: - -```ts -const instance: Record = { - [CipherType.Login]: true, - [CipherType.SecureNote]: false, - [CipherType.Card]: true, - [CipherType.Identity]: true, - [CipherType.SshKey]: true, -}; -``` - -#### Why does this happen? - -The members of `const _CipherType` all have a [literal type][literal-type]. `_CipherType.Login`, for -example, has a literal type of `1`. `type CipherType` maps over these members, aggregating them into -the structural type `1 | 2 | 3 | 4 | 5`. - -`const CipherType` asserts its members have `type CipherType`, which overrides the literal types the -compiler inferred for the member in `const _CipherType`. The compiler sees the type of -`CipherType.Login` as `type CipherType` (which aliases `1 | 2 | 3 | 4 | 5`). - -Now consider a mapped type definition: - -```ts -// `MappedType` is structurally identical to Record -type MappedType = { [K in CipherType]: boolean }; -``` - -When the compiler examines `instance`, it only knows that the type of each of its members is -`CipherType`. That is, the type of `instance` to the compiler is -`{ [K in 1 | 2 | 3 | 4 | 5]?: boolean }`. This doesn't sufficiently overlap with `MappedType`, which -is looking for `{ [1]: boolean, [2]: boolean, [3]: boolean, [4]: boolean, [5]: boolean }`. The -failure occurs, because the inferred type can have fewer fields than `MappedType`. - -### Workarounds - -**Option A: Assert the type is correct.** You need to manually verify this. The compiler cannot -typecheck it. - -```ts -const instance: MappedType = { - [CipherType.Login]: true, - // ... -} as MappedType; -``` - -**Option B: Define the mapped type as a partial.** Then, inspect its properties before using them. - -```ts -type MappedType = { [K in CipherType]?: boolean }; -const instance: MappedType = { - [CipherType.Login]: true, - // ... -}; - -if (CipherType.Login in instance) { - // work with `instance[CipherType.Login]` -} -``` - -**Option C: Use a collection.** Consider this approach when downstream code reflects over the result -with `in` or using methods like `Object.keys`. - -```ts -const collection = new Map([[CipherType.Login, true]]); - -const instance = collection.get(CipherType.Login); -if (instance) { - // work with `instance` -} - -const available = [CipherType.Login, CipherType.Card]; -if (available.includes(CipherType.Login)) { - // ... -} -``` - -[computed-property-names]: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#computed_property_names -[literal-type]: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types [no-enum-lint]: https://github.com/bitwarden/clients/blob/main/libs/eslint/platform/no-enums.mjs [no-enum-configuration]: https://github.com/bitwarden/clients/blob/032fedf308ec251f17632d7d08c4daf6f41a4b1d/eslint.config.mjs#L77 -[no-member-fields-fixed]: - https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#preserved-computed-property-names-in-declaration-files diff --git a/docs/contributing/code-style/enums.md b/docs/contributing/code-style/enums.md index 4d972ce0c..0f16cbaab 100644 --- a/docs/contributing/code-style/enums.md +++ b/docs/contributing/code-style/enums.md @@ -33,7 +33,7 @@ export enum CipherType = { You can redefine it as an object like so: ```ts -const _CipherType = { +const CipherType = { Login: 1, SecureNote: 2, Card: 3, @@ -41,11 +41,7 @@ const _CipherType = { SshKey: 5, } as const; -type _CipherType = typeof _CipherType; - -export type CipherType = _CipherType[keyof _CipherType]; -export const CipherType: Readonly<{ [K in keyof typeof _CipherType]: CipherType }> = - Object.freeze(_CipherType); +export type CipherType = CipherType[keyof typeof CipherType]; ``` And use it like so: @@ -61,6 +57,23 @@ function doSomething(type: CipherType) {} doSomething(CipherType.Card); ``` +:::warning + +Unlike an enum, typescript lifts the type of the members of `const CipherType` to `number`. Code +like the following requires you explicitly type your variables: + +```ts +// ✅ Do: strongly type enum-likes +const subject = new Subject(); +let value: CipherType = CipherType.Login; + +// ❌ Do not: use type inference +const array = [CipherType.Login]; // infers `number[]` +let value = CipherType.Login; // infers `1` +``` + +::: + The following utilities may assist introspection: ```ts From 22d9b56d85857ce9a6b9ca6b202e56dacc57fbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 11:24:27 -0400 Subject: [PATCH 02/12] refinements from architecture meeting --- docs/contributing/code-style/enums.md | 32 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/docs/contributing/code-style/enums.md b/docs/contributing/code-style/enums.md index 0f16cbaab..db15ae7ce 100644 --- a/docs/contributing/code-style/enums.md +++ b/docs/contributing/code-style/enums.md @@ -7,15 +7,9 @@ use [constant objects][constant-object-pattern] instead of introducing a new enu - Use the same name for your type- and value-declaration. - Use `type` to derive type information from the const object. +- Avoid asserting the type of an enum-like. Use explicit types instead. - Create utilities to convert and identify enums modelled as primitives. -:::tip - -This pattern should simplify the usage of your new objects, improve type safety in files that have -adopted TS-strict, and make transitioning an enum to a const object much easier. - -::: - ### Example Given the following enum: @@ -33,14 +27,16 @@ export enum CipherType = { You can redefine it as an object like so: ```ts -const CipherType = { +// freeze to prevent member injection +export const CipherType = Object.freeze({ Login: 1, SecureNote: 2, Card: 3, Identity: 4, SshKey: 5, -} as const; +} as const); +// derive the enum-like type from the raw data export type CipherType = CipherType[keyof typeof CipherType]; ``` @@ -55,6 +51,11 @@ function doSomething(type: CipherType) {} // And used as a value (just like a regular `enum`) doSomething(CipherType.Card); + +// advanced use-case: discriminated union definition +type CipherContent = + | { type: typeof CipherType.Login, username: EncString, ... } + | { type: typeof CipherType.SecureNote, note: EncString, ... } ``` :::warning @@ -64,17 +65,24 @@ like the following requires you explicitly type your variables: ```ts // ✅ Do: strongly type enum-likes -const subject = new Subject(); let value: CipherType = CipherType.Login; +const array: CipherType[] = [CipherType.Login]; +const subject = new Subject(); // ❌ Do not: use type inference -const array = [CipherType.Login]; // infers `number[]` let value = CipherType.Login; // infers `1` +const array = [CipherType.Login]; // infers `number[]` + +// ❌ Do not: use type assertions +let value = CipherType.Login as CipherType; // this operation is unsafe ``` ::: -The following utilities may assist introspection: +## Utilities + +The following utilities can be used to maintain type safety after compilation. This code assumes +`const CipherType` is frozen. ```ts import { CipherType } from "./cipher-type"; From e864c6de2cbfdaa2d193acae8e4f5225df06c9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 11:26:47 -0400 Subject: [PATCH 03/12] fix capitalizaton --- docs/architecture/adr/0025-ts-deprecate-enums.md | 9 +++++---- docs/contributing/code-style/enums.md | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/architecture/adr/0025-ts-deprecate-enums.md b/docs/architecture/adr/0025-ts-deprecate-enums.md index d9afe181f..3e2a9665f 100644 --- a/docs/architecture/adr/0025-ts-deprecate-enums.md +++ b/docs/architecture/adr/0025-ts-deprecate-enums.md @@ -35,7 +35,6 @@ In most cases, enums are unnecessary. A readonly (`as const`) object coupled wit avoids both code generation and type inconsistencies. ```ts -// declare the raw data and reduce repetition with an internal type const CipherType = Object.freeze({ Login: 1, SecureNote: 2, @@ -44,7 +43,6 @@ const CipherType = Object.freeze({ SshKey: 5, } as const); -// derive the enum-like type from the raw data export type CipherType = _CipherType[keyof typeof CipherType]; ``` @@ -53,7 +51,7 @@ an enum. :::warning -Unlike an enum, typescript lifts the type of the members of `const CipherType` to `number`. Code +Unlike an enum, TypeScript lifts the type of the members of `const CipherType` to `number`. Code like the following requires you explicitly type your variables: ```ts @@ -75,7 +73,7 @@ let value = CipherType.Login; // infers `1` - **Deprecate enum use** - Allow enums to exist for historic or technical purposes, but prohibit the introduction of new ones. Reduce the lint to a "warning" and allow the lint to be disabled. - **Eliminate enum use** - This is the current state of affairs. Prohibit the introduction of any - new enum and replace all enums in the codebase with typescript objects. Prohibit disabling of the + new enum and replace all enums in the codebase with TypeScript objects. Prohibit disabling of the lint. ## Decision Outcome @@ -85,6 +83,8 @@ Chosen option: **Deprecate enum use** ### Positive Consequences - Allows for cases where autogenerated code introduces an enum by necessity. +- Literals (e.g. `1`) convert to the enum-like type with full type safety. +- Works with mapped types such as `Record` and discriminated unions. - Developers receive a warning in their IDE to discourage new enums. - The warning can direct them to our contributing docs, where they can learn typesafe alternatives. - Our compiled code size decreases when enums are replaced. @@ -94,6 +94,7 @@ Chosen option: **Deprecate enum use** - Unnecessary usage may persist indefinitely on teams carrying a high tech debt. - The lint increased the number of FIXME comments in the code by about 10%. +- Enum-likes cannot be referenced by angular templates ### Plan diff --git a/docs/contributing/code-style/enums.md b/docs/contributing/code-style/enums.md index db15ae7ce..727adf4eb 100644 --- a/docs/contributing/code-style/enums.md +++ b/docs/contributing/code-style/enums.md @@ -60,7 +60,7 @@ type CipherContent = :::warning -Unlike an enum, typescript lifts the type of the members of `const CipherType` to `number`. Code +Unlike an enum, TypeScript lifts the type of the members of `const CipherType` to `number`. Code like the following requires you explicitly type your variables: ```ts From 5d554dc717a06b0c9ebcf4496cee793e2a6c9b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 11:29:36 -0400 Subject: [PATCH 04/12] switch status to active --- docs/architecture/adr/0025-ts-deprecate-enums.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/architecture/adr/0025-ts-deprecate-enums.md b/docs/architecture/adr/0025-ts-deprecate-enums.md index 3e2a9665f..b1a279302 100644 --- a/docs/architecture/adr/0025-ts-deprecate-enums.md +++ b/docs/architecture/adr/0025-ts-deprecate-enums.md @@ -1,7 +1,7 @@ --- adr: "0025" -status: Proposed -date: 2025-05-30 +status: Accepted +date: 2025-06-24 tags: [clients, typescript] --- From 2060cc8e3fb00852b8e06e7097b80c9167720e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 14:09:03 -0400 Subject: [PATCH 05/12] add string-based enum example --- docs/contributing/code-style/enums.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/contributing/code-style/enums.md b/docs/contributing/code-style/enums.md index 727adf4eb..8d81fdd2e 100644 --- a/docs/contributing/code-style/enums.md +++ b/docs/contributing/code-style/enums.md @@ -58,6 +58,21 @@ type CipherContent = | { type: typeof CipherType.SecureNote, note: EncString, ... } ``` +The above pattern also works with string-typed enum members: + +```ts +// freeze to prevent member injection +export const CredentialType = Object.freeze({ + Password: "password", + Username: "username", + Email: "email", + SshKey: "ssh-key", +} as const); + +// derive the enum-like type from the raw data +export type CredentialType = CredentialType[keyof typeof CredentialType]; +``` + :::warning Unlike an enum, TypeScript lifts the type of the members of `const CipherType` to `number`. Code From 11b9f9716a61e012400a5847f0c46185dd275416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 14:19:59 -0400 Subject: [PATCH 06/12] fix enum syntax error in code style docs --- docs/contributing/code-style/enums.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing/code-style/enums.md b/docs/contributing/code-style/enums.md index 8d81fdd2e..42a51e6e7 100644 --- a/docs/contributing/code-style/enums.md +++ b/docs/contributing/code-style/enums.md @@ -15,7 +15,7 @@ use [constant objects][constant-object-pattern] instead of introducing a new enu Given the following enum: ```ts -export enum CipherType = { +export enum CipherType { Login: 1, SecureNote: 2, Card: 3, From a24fd7574a3762853d176f67cc6ccc25ff8e3ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 14:56:33 -0400 Subject: [PATCH 07/12] add angular guidance from architecture review --- docs/contributing/code-style/angular.md | 49 +++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/docs/contributing/code-style/angular.md b/docs/contributing/code-style/angular.md index 2a26a8cfa..94f7ef42c 100644 --- a/docs/contributing/code-style/angular.md +++ b/docs/contributing/code-style/angular.md @@ -194,3 +194,52 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" export class DifferentPackageService {} ``` + +### String-backed Enum-likes ([ADR-0025](../../architecture/adr/0025-ts-deprecate-enums.md)) + +String-typed enum likes can be used as inputs of a component directly. Simply expose the enum-like +property from your component: + +```ts +// given: +const EnumLike = { Some = "some", Value: "value" }; +type EnumLike = EnumLike[keyof typeof EnumLike]; + +// add the input: +@Component({ ... }) +class YourComponent { + @Input() input: EnumLike = EnumLike.Some; + + // ... +} +``` + +Composers can use the enum's string values directly: + +```html + +``` + +### Numeric Enum-likes ([ADR-0025](../../architecture/adr/0025-ts-deprecate-enums.md)) + +Using numeric enum-likes in components should be avoided. If it is necessary, follow the same +pattern as a string-backed enum. + +Composers that need hard-coded enum-likes in their template should expose the data from their +component: + +```ts +import { EnumLike } from "..."; + +// add the input to your component: +@Component({ ... }) +class TheirComponent { + protected readonly EnumLike = EnumLike; +} +``` + +And then bind the input in the template: + +```ts + +``` From ef44b1cda78acd74745a034d7a77bbe03b3030ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 15:07:53 -0400 Subject: [PATCH 08/12] refine enum code style guidance --- docs/contributing/code-style/enums.md | 50 ++++++++++++++++++--------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/docs/contributing/code-style/enums.md b/docs/contributing/code-style/enums.md index 42a51e6e7..405a51bf5 100644 --- a/docs/contributing/code-style/enums.md +++ b/docs/contributing/code-style/enums.md @@ -10,7 +10,7 @@ use [constant objects][constant-object-pattern] instead of introducing a new enu - Avoid asserting the type of an enum-like. Use explicit types instead. - Create utilities to convert and identify enums modelled as primitives. -### Example +### Numeric enum-likes Given the following enum: @@ -58,6 +58,29 @@ type CipherContent = | { type: typeof CipherType.SecureNote, note: EncString, ... } ``` +:::warning + +Unlike an enum, TypeScript lifts the type of the members of `const CipherType` to `number`. Code +like the following requires you explicitly type your variables: + +```ts +// ✅ Do: strongly type enum-likes +let value: CipherType = CipherType.Login; +const array: CipherType[] = [CipherType.Login]; +const subject = new Subject(); + +// ❌ Do not: use type inference +let value = CipherType.Login; // infers `1` +const array = [CipherType.Login]; // infers `number[]` + +// ❌ Do not: use type assertions +let value = CipherType.Login as CipherType; // this operation is unsafe +``` + +::: + +### String enum-likes + The above pattern also works with string-typed enum members: ```ts @@ -73,31 +96,26 @@ export const CredentialType = Object.freeze({ export type CredentialType = CredentialType[keyof typeof CredentialType]; ``` -:::warning +:::note[Enum-likes are structural types!] -Unlike an enum, TypeScript lifts the type of the members of `const CipherType` to `number`. Code -like the following requires you explicitly type your variables: +Unlike string-typed enums, enum-likes do not reify a type for each member. This means that you can +use their string value or their enum member interchangeably. ```ts -// ✅ Do: strongly type enum-likes -let value: CipherType = CipherType.Login; -const array: CipherType[] = [CipherType.Login]; -const subject = new Subject(); +let value: CredentialType = CredentialType.Username; -// ❌ Do not: use type inference -let value = CipherType.Login; // infers `1` -const array = [CipherType.Login]; // infers `number[]` - -// ❌ Do not: use type assertions -let value = CipherType.Login as CipherType; // this operation is unsafe +// this is typesafe! +value = "email"; ``` +However, the string-typed values are not always identified as enum members. Thus, when the const +object is in scope, prefer it to the literal value. + ::: ## Utilities -The following utilities can be used to maintain type safety after compilation. This code assumes -`const CipherType` is frozen. +The following utilities can be used to maintain type safety at runtime. ```ts import { CipherType } from "./cipher-type"; From 78f5a93161706fe8676b4732df5a66a8eefc0248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 15:12:58 -0400 Subject: [PATCH 09/12] fix headers --- docs/contributing/code-style/angular.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/contributing/code-style/angular.md b/docs/contributing/code-style/angular.md index 94f7ef42c..0f7322978 100644 --- a/docs/contributing/code-style/angular.md +++ b/docs/contributing/code-style/angular.md @@ -195,7 +195,11 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" export class DifferentPackageService {} ``` -### String-backed Enum-likes ([ADR-0025](../../architecture/adr/0025-ts-deprecate-enums.md)) +## Enum-likes ([ADR-0025](../../architecture/adr/0025-ts-deprecate-enums.md)) + +For general guidance on enum-likes, consult [Avoid TypeScript Enums](./enums.md). + +### String-backed Enum-likes String-typed enum likes can be used as inputs of a component directly. Simply expose the enum-like property from your component: @@ -220,7 +224,7 @@ Composers can use the enum's string values directly: ``` -### Numeric Enum-likes ([ADR-0025](../../architecture/adr/0025-ts-deprecate-enums.md)) +### Numeric Enum-likes Using numeric enum-likes in components should be avoided. If it is necessary, follow the same pattern as a string-backed enum. From 672eb5d90fee0e2e6600dfb05f72214c881da404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 15:20:40 -0400 Subject: [PATCH 10/12] distinguish published and accepted dates in front matter --- docs/architecture/adr/0025-ts-deprecate-enums.md | 3 ++- src/components/AdrTable.tsx | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/architecture/adr/0025-ts-deprecate-enums.md b/docs/architecture/adr/0025-ts-deprecate-enums.md index b1a279302..9b592a14d 100644 --- a/docs/architecture/adr/0025-ts-deprecate-enums.md +++ b/docs/architecture/adr/0025-ts-deprecate-enums.md @@ -1,7 +1,8 @@ --- adr: "0025" status: Accepted -date: 2025-06-24 +date: 2025-05-30 +accepted: 2025-06-24 tags: [clients, typescript] --- diff --git a/src/components/AdrTable.tsx b/src/components/AdrTable.tsx index c915e1dba..21a25ec63 100644 --- a/src/components/AdrTable.tsx +++ b/src/components/AdrTable.tsx @@ -36,6 +36,12 @@ export default function AdrTable({ frontMatter }): JSX.Element { Published: {formatDate(frontMatter.date)} + {frontMatter.accepted && ( + + Accepted: + {formatDate(frontMatter.accepted)} + + )} ); From cbcbce8c45d0f20a4aa3e0906887e2d44cdb2c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 15:41:53 -0400 Subject: [PATCH 11/12] Revert "distinguish published and accepted dates in front matter" This reverts commit 672eb5d90fee0e2e6600dfb05f72214c881da404. --- docs/architecture/adr/0025-ts-deprecate-enums.md | 3 +-- src/components/AdrTable.tsx | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/docs/architecture/adr/0025-ts-deprecate-enums.md b/docs/architecture/adr/0025-ts-deprecate-enums.md index 9b592a14d..b1a279302 100644 --- a/docs/architecture/adr/0025-ts-deprecate-enums.md +++ b/docs/architecture/adr/0025-ts-deprecate-enums.md @@ -1,8 +1,7 @@ --- adr: "0025" status: Accepted -date: 2025-05-30 -accepted: 2025-06-24 +date: 2025-06-24 tags: [clients, typescript] --- diff --git a/src/components/AdrTable.tsx b/src/components/AdrTable.tsx index 21a25ec63..c915e1dba 100644 --- a/src/components/AdrTable.tsx +++ b/src/components/AdrTable.tsx @@ -36,12 +36,6 @@ export default function AdrTable({ frontMatter }): JSX.Element { Published: {formatDate(frontMatter.date)} - {frontMatter.accepted && ( - - Accepted: - {formatDate(frontMatter.accepted)} - - )} ); From 041223df4bbc42e3e62e2002e25b88ddf0515b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Tue, 24 Jun 2025 15:42:59 -0400 Subject: [PATCH 12/12] restore published date and status --- docs/architecture/adr/0025-ts-deprecate-enums.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr/0025-ts-deprecate-enums.md b/docs/architecture/adr/0025-ts-deprecate-enums.md index b1a279302..d37bc912f 100644 --- a/docs/architecture/adr/0025-ts-deprecate-enums.md +++ b/docs/architecture/adr/0025-ts-deprecate-enums.md @@ -1,7 +1,7 @@ --- adr: "0025" status: Accepted -date: 2025-06-24 +date: 2025-05-30 tags: [clients, typescript] ---