Closed
Description
lib Update Request
Configuration Check
My compilation target is ES2015
and my lib is [ "dom", "es5", "es6", "es2017", "scripthost", "es2015.collection", "es2015.promise" ]
.
Missing / Incorrect Definition
the properties of the Intl.NumberFormatOptions
are very generic compared to other Options within the Intl
scope. As for example the localeMatcher
is only a string. For the Intl.DatetimeFormatOption
it is more restrictive. Only 'best fit' and 'lookup' are allowed. Actually nearly every property of the Intl.NumberFormatOptions
is not restricted as the MDN docs suggest. It would be nice to have type restrictions similar to other types within Intl
.
I think this even applies to other Options-Definitions.
for example: Intl.CollatorOptions
Sample Code
// lib.es5.d.ts
interface DateTimeFormatOptions {
localeMatcher?: "best fit" | "lookup";
weekday?: "long" | "short" | "narrow";
era?: "long" | "short" | "narrow";
year?: "numeric" | "2-digit";
month?: "numeric" | "2-digit" | "long" | "short" | "narrow";
day?: "numeric" | "2-digit";
hour?: "numeric" | "2-digit";
minute?: "numeric" | "2-digit";
second?: "numeric" | "2-digit";
timeZoneName?: "long" | "short";
formatMatcher?: "best fit" | "basic";
hour12?: boolean;
timeZone?: string;
}
// lib.es5.d.ts
interface NumberFormatOptions {
localeMatcher?: string;
style?: string;
currency?: string;
currencyDisplay?: string;
currencySign?: string;
useGrouping?: boolean;
minimumIntegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
}
Documentation Link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment