lib.es2018.intl.d.ts (3021B)
1 /*! ***************************************************************************** 2 Copyright (c) Microsoft Corporation. All rights reserved. 3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 this file except in compliance with the License. You may obtain a copy of the 5 License at http://www.apache.org/licenses/LICENSE-2.0 6 7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 10 MERCHANTABLITY OR NON-INFRINGEMENT. 11 12 See the Apache Version 2.0 License for specific language governing permissions 13 and limitations under the License. 14 ***************************************************************************** */ 15 16 17 /// <reference no-default-lib="true"/> 18 19 declare namespace Intl { 20 // http://cldr.unicode.org/index/cldr-spec/plural-rules#TOC-Determining-Plural-Categories 21 type LDMLPluralRule = "zero" | "one" | "two" | "few" | "many" | "other"; 22 type PluralRuleType = "cardinal" | "ordinal"; 23 24 interface PluralRulesOptions { 25 localeMatcher?: "lookup" | "best fit" | undefined; 26 type?: PluralRuleType | undefined; 27 minimumIntegerDigits?: number | undefined; 28 minimumFractionDigits?: number | undefined; 29 maximumFractionDigits?: number | undefined; 30 minimumSignificantDigits?: number | undefined; 31 maximumSignificantDigits?: number | undefined; 32 } 33 34 interface ResolvedPluralRulesOptions { 35 locale: string; 36 pluralCategories: LDMLPluralRule[]; 37 type: PluralRuleType; 38 minimumIntegerDigits: number; 39 minimumFractionDigits: number; 40 maximumFractionDigits: number; 41 minimumSignificantDigits?: number; 42 maximumSignificantDigits?: number; 43 } 44 45 interface PluralRules { 46 resolvedOptions(): ResolvedPluralRulesOptions; 47 select(n: number): LDMLPluralRule; 48 } 49 50 interface PluralRulesConstructor { 51 new (locales?: string | readonly string[], options?: PluralRulesOptions): PluralRules; 52 (locales?: string | readonly string[], options?: PluralRulesOptions): PluralRules; 53 supportedLocalesOf(locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; 54 } 55 56 const PluralRules: PluralRulesConstructor; 57 58 interface NumberFormatPartTypeRegistry { 59 literal: never; 60 nan: never; 61 infinity: never; 62 percent: never; 63 integer: never; 64 group: never; 65 decimal: never; 66 fraction: never; 67 plusSign: never; 68 minusSign: never; 69 percentSign: never; 70 currency: never; 71 } 72 73 type NumberFormatPartTypes = keyof NumberFormatPartTypeRegistry; 74 75 interface NumberFormatPart { 76 type: NumberFormatPartTypes; 77 value: string; 78 } 79 80 interface NumberFormat { 81 formatToParts(number?: number | bigint): NumberFormatPart[]; 82 } 83 }