lib.es2023.intl.d.ts (2645B)
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 interface NumberFormatOptionsUseGroupingRegistry { 21 min2: never; 22 auto: never; 23 always: never; 24 } 25 26 interface NumberFormatOptionsSignDisplayRegistry { 27 negative: never; 28 } 29 30 interface NumberFormatOptions { 31 roundingPriority?: "auto" | "morePrecision" | "lessPrecision" | undefined; 32 roundingIncrement?: 1 | 2 | 5 | 10 | 20 | 25 | 50 | 100 | 200 | 250 | 500 | 1000 | 2000 | 2500 | 5000 | undefined; 33 roundingMode?: "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven" | undefined; 34 trailingZeroDisplay?: "auto" | "stripIfInteger" | undefined; 35 } 36 37 interface ResolvedNumberFormatOptions { 38 roundingPriority: "auto" | "morePrecision" | "lessPrecision"; 39 roundingMode: "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven"; 40 roundingIncrement: 1 | 2 | 5 | 10 | 20 | 25 | 50 | 100 | 200 | 250 | 500 | 1000 | 2000 | 2500 | 5000; 41 trailingZeroDisplay: "auto" | "stripIfInteger"; 42 } 43 44 interface NumberRangeFormatPart extends NumberFormatPart { 45 source: "startRange" | "endRange" | "shared"; 46 } 47 48 type StringNumericLiteral = `${number}` | "Infinity" | "-Infinity" | "+Infinity"; 49 50 interface NumberFormat { 51 format(value: number | bigint | StringNumericLiteral): string; 52 formatToParts(value: number | bigint | StringNumericLiteral): NumberFormatPart[]; 53 formatRange(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): string; 54 formatRangeToParts(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): NumberRangeFormatPart[]; 55 } 56 }