lib.es2023.intl.d.ts 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  7. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  8. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  9. MERCHANTABLITY OR NON-INFRINGEMENT.
  10. See the Apache Version 2.0 License for specific language governing permissions
  11. and limitations under the License.
  12. ***************************************************************************** */
  13. /// <reference no-default-lib="true"/>
  14. declare namespace Intl {
  15. interface NumberFormatOptionsUseGroupingRegistry {
  16. min2: never;
  17. auto: never;
  18. always: never;
  19. }
  20. interface NumberFormatOptionsSignDisplayRegistry {
  21. negative: never;
  22. }
  23. interface NumberFormatOptions {
  24. roundingPriority?: "auto" | "morePrecision" | "lessPrecision" | undefined;
  25. roundingIncrement?: 1 | 2 | 5 | 10 | 20 | 25 | 50 | 100 | 200 | 250 | 500 | 1000 | 2000 | 2500 | 5000 | undefined;
  26. roundingMode?: "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven" | undefined;
  27. trailingZeroDisplay?: "auto" | "stripIfInteger" | undefined;
  28. }
  29. interface ResolvedNumberFormatOptions {
  30. roundingPriority: "auto" | "morePrecision" | "lessPrecision";
  31. roundingMode: "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven";
  32. roundingIncrement: 1 | 2 | 5 | 10 | 20 | 25 | 50 | 100 | 200 | 250 | 500 | 1000 | 2000 | 2500 | 5000;
  33. trailingZeroDisplay: "auto" | "stripIfInteger";
  34. }
  35. interface NumberRangeFormatPart extends NumberFormatPart {
  36. source: "startRange" | "endRange" | "shared";
  37. }
  38. type StringNumericLiteral = `${number}` | "Infinity" | "-Infinity" | "+Infinity";
  39. interface NumberFormat {
  40. format(value: number | bigint | StringNumericLiteral): string;
  41. formatToParts(value: number | bigint | StringNumericLiteral): NumberFormatPart[];
  42. formatRange(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): string;
  43. formatRangeToParts(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): NumberRangeFormatPart[];
  44. }
  45. }