@formatjs/intl-durationformat 0.10.17 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -23,11 +23,11 @@ interface DurationRecord {
23
23
  microseconds: number;
24
24
  nanoseconds: number;
25
25
  }
26
- //#endregion
27
- //#region packages/intl-durationformat/types.d.ts
28
- type DurationFormatOptions = Partial<ResolvedDurationFormatOptions>;
26
+ type DurationFormatOptions = Partial<Omit<ResolvedDurationFormatOptions, "locale">> & {
27
+ localeMatcher?: "best fit" | "lookup";
28
+ };
29
29
  interface ResolvedDurationFormatOptions {
30
- localeMatcher: "best fit" | "lookup";
30
+ locale: string;
31
31
  style: "long" | "short" | "narrow" | "digital";
32
32
  years: "long" | "short" | "narrow";
33
33
  yearsDisplay: "always" | "auto";
@@ -51,13 +51,19 @@ interface ResolvedDurationFormatOptions {
51
51
  nanosecondsDisplay: "always" | "auto";
52
52
  fractionalDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
53
53
  numberingSystem: string;
54
- round: boolean;
55
54
  }
56
55
  interface DurationFormatPart {
57
56
  unit?: string;
58
57
  type: unknown;
59
58
  value: string;
60
59
  }
60
+ interface DurationFormat$1 {
61
+ resolvedOptions(): ResolvedDurationFormatOptions;
62
+ formatToParts(duration: DurationInput | string): DurationFormatPart[];
63
+ format(duration: DurationInput | string): string;
64
+ }
65
+ //#endregion
66
+ //#region packages/intl-durationformat/types.d.ts
61
67
  interface RawDurationLocaleData {
62
68
  data: DurationFormatLocaleInternalData;
63
69
  locale: string;
@@ -66,11 +72,6 @@ interface DurationFormatLocaleInternalData {
66
72
  nu: readonly string[];
67
73
  digitalFormat: Record<string, string>;
68
74
  }
69
- interface DurationFormat$1 {
70
- resolvedOptions(): ResolvedDurationFormatOptions;
71
- formatToParts(duration: DurationInput): DurationFormatPart[];
72
- format(duration: DurationInput): string;
73
- }
74
75
  interface IntlDurationFormatInternal {
75
76
  initializedDurationFormat: boolean;
76
77
  fractionalDigits: number | undefined;
@@ -112,14 +113,14 @@ interface DurationFormatConstructor {
112
113
  //#endregion
113
114
  //#region packages/intl-durationformat/core.d.ts
114
115
  /**
115
- * DurationFormat provides locale-sensitive duration formatting
116
- * Implements the Intl.DurationFormat API from the TC39 proposal
117
- */
118
- declare class DurationFormat implements DurationFormat$1 {
116
+ * DurationFormat provides locale-sensitive duration formatting
117
+ * Implements the Intl.DurationFormat API from the TC39 proposal
118
+ */
119
+ export declare class DurationFormat implements DurationFormat$1 {
119
120
  constructor(locales?: string | string[], options?: DurationFormatOptions);
120
121
  resolvedOptions(): ResolvedDurationFormatOptions;
121
- formatToParts(duration: DurationInput): DurationFormatPart[];
122
- format(duration: DurationInput): string;
122
+ formatToParts(duration: DurationInput | string): DurationFormatPart[];
123
+ format(duration: DurationInput | string): string;
123
124
  static supportedLocalesOf(locales: string | string[], options?: Pick<DurationFormatOptions, "localeMatcher">): string[];
124
125
  static __defaultLocale: string;
125
126
  static availableLocales: Set<string>;
@@ -128,5 +129,5 @@ declare class DurationFormat implements DurationFormat$1 {
128
129
  static polyfilled: boolean;
129
130
  }
130
131
  //#endregion
131
- export { DurationFormat, type DurationFormatConstructor, type DurationFormatLocaleInternalData, type DurationFormatOptions, type DurationFormatPart, type DurationInput, type DurationRecord, type IntlDurationFormatInternal, type RawDurationLocaleData, type ResolvedDurationFormatOptions };
132
+ export type { DurationFormatConstructor, DurationFormatLocaleInternalData, DurationFormatOptions, DurationFormatPart, DurationInput, DurationRecord, IntlDurationFormatInternal, RawDurationLocaleData, ResolvedDurationFormatOptions };
132
133
  //# sourceMappingURL=index.d.ts.map