summaryrefslogtreecommitdiff
path: root/cli/dts/lib.es2020.intl.d.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2022-09-20 07:00:01 +1000
committerGitHub <noreply@github.com>2022-09-20 07:00:01 +1000
commit73e89844bab930f2a2821b059743faed8372ed14 (patch)
tree7d6e8ef6736e41fd98293d533208b5ebb404c5b6 /cli/dts/lib.es2020.intl.d.ts
parent79aee3668db88be00673e920d4924626831aff88 (diff)
feat(cli): update to TypeScript 4.8 (#15064)
Diffstat (limited to 'cli/dts/lib.es2020.intl.d.ts')
-rw-r--r--cli/dts/lib.es2020.intl.d.ts35
1 files changed, 30 insertions, 5 deletions
diff --git a/cli/dts/lib.es2020.intl.d.ts b/cli/dts/lib.es2020.intl.d.ts
index af981e31c..5bce3812d 100644
--- a/cli/dts/lib.es2020.intl.d.ts
+++ b/cli/dts/lib.es2020.intl.d.ts
@@ -18,6 +18,7 @@ and limitations under the License.
/// <reference no-default-lib="true"/>
+/// <reference lib="es2018.intl" />
declare namespace Intl {
/**
@@ -51,6 +52,25 @@ declare namespace Intl {
| "seconds";
/**
+ * Value of the `unit` property in objects returned by
+ * `Intl.RelativeTimeFormat.prototype.formatToParts()`. `formatToParts` and
+ * `format` methods accept either singular or plural unit names as input,
+ * but `formatToParts` only outputs singular (e.g. "day") not plural (e.g.
+ * "days").
+ *
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).
+ */
+ type RelativeTimeFormatUnitSingular =
+ | "year"
+ | "quarter"
+ | "month"
+ | "week"
+ | "day"
+ | "hour"
+ | "minute"
+ | "second";
+
+ /**
* The locale matching algorithm to use.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
@@ -120,11 +140,16 @@ declare namespace Intl {
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).
*/
- interface RelativeTimeFormatPart {
- type: string;
- value: string;
- unit?: RelativeTimeFormatUnit;
- }
+ type RelativeTimeFormatPart =
+ | {
+ type: "literal";
+ value: string;
+ }
+ | {
+ type: Exclude<NumberFormatPartTypes, "literal">;
+ value: string;
+ unit: RelativeTimeFormatUnitSingular;
+ };
interface RelativeTimeFormat {
/**