From 6c255e0ccb652b27d5d746c1c8abb50f2ba2aeab Mon Sep 17 00:00:00 2001 From: Tao Zhou Date: Thu, 16 Mar 2023 09:51:48 -0700 Subject: [PATCH 1/2] fix(macro types): mark `other` as required for ChoiceOptions --- packages/macro/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/macro/index.d.ts b/packages/macro/index.d.ts index 69a30f842..1f1ef7346 100644 --- a/packages/macro/index.d.ts +++ b/packages/macro/index.d.ts @@ -13,7 +13,7 @@ export type ChoiceOptions = { many?: string /** Catch-all option */ - other?: string + other: string /** Exact match form, corresponds to =N rule */ [digit: `${number}`]: string } From ace89d4db9c78ff9a4111a7823f061475ac8a3e7 Mon Sep 17 00:00:00 2001 From: Tao Zhou Date: Thu, 16 Mar 2023 10:51:21 -0700 Subject: [PATCH 2/2] Add type tests --- packages/macro/__typetests__/index.test-d.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/macro/__typetests__/index.test-d.tsx b/packages/macro/__typetests__/index.test-d.tsx index 2dbcd3887..771507296 100644 --- a/packages/macro/__typetests__/index.test-d.tsx +++ b/packages/macro/__typetests__/index.test-d.tsx @@ -143,6 +143,9 @@ expectType( }) ) +// @ts-expect-error: other is required +expectType(plural(5, { one: "test" })) + /////////////////// //// Select Ordinal ///////////////////