From 28f38cee3a9ce10604546a85af85de18ab2ba70d Mon Sep 17 00:00:00 2001
From: jihndai <73680880+jihndai@users.noreply.github.com>
Date: Wed, 9 Feb 2022 13:29:09 -0400
Subject: [PATCH 1/4] add Intl.Locale param type to locales argument in BigInt,
Number, and Date methods
---
src/compiler/commandLineParser.ts | 2 ++
src/lib/es2020.bigint.d.ts | 4 +++-
src/lib/es2020.d.ts | 2 ++
src/lib/es2020.date.d.ts | 24 ++++++++++++++++++++++++
src/lib/es2020.intl.d.ts | 7 +++++++
src/lib/es2020.number.d.ts | 10 ++++++++++
src/lib/libs.json | 2 ++
7 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 src/lib/es2020.date.d.ts
create mode 100644 src/lib/es2020.number.d.ts
diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts
index f04945739b54e..16d5222146367 100644
--- a/src/compiler/commandLineParser.ts
+++ b/src/compiler/commandLineParser.ts
@@ -68,11 +68,13 @@ namespace ts {
["es2019.string", "lib.es2019.string.d.ts"],
["es2019.symbol", "lib.es2019.symbol.d.ts"],
["es2020.bigint", "lib.es2020.bigint.d.ts"],
+ ["es2020.date", "lib.es2020.date.d.ts"],
["es2020.promise", "lib.es2020.promise.d.ts"],
["es2020.sharedmemory", "lib.es2020.sharedmemory.d.ts"],
["es2020.string", "lib.es2020.string.d.ts"],
["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
["es2020.intl", "lib.es2020.intl.d.ts"],
+ ["es2020.number", "lib.es2020.number.d.ts"],
["es2021.promise", "lib.es2021.promise.d.ts"],
["es2021.string", "lib.es2021.string.d.ts"],
["es2021.weakref", "lib.es2021.weakref.d.ts"],
diff --git a/src/lib/es2020.bigint.d.ts b/src/lib/es2020.bigint.d.ts
index 659fa1a428775..50a10c7b33e89 100644
--- a/src/lib/es2020.bigint.d.ts
+++ b/src/lib/es2020.bigint.d.ts
@@ -1,3 +1,5 @@
+///
+
interface BigIntToLocaleStringOptions {
/**
* The locale matching algorithm to use.The default is "best fit". For information about this option, see the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation Intl page}.
@@ -92,7 +94,7 @@ interface BigInt {
toString(radix?: number): string;
/** Returns a string representation appropriate to the host environment's current locale. */
- toLocaleString(locales?: string, options?: BigIntToLocaleStringOptions): string;
+ toLocaleString(locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions): string;
/** Returns the primitive value of the specified object. */
valueOf(): bigint;
diff --git a/src/lib/es2020.d.ts b/src/lib/es2020.d.ts
index f420cd61b1d47..8d1fa3bf77d54 100644
--- a/src/lib/es2020.d.ts
+++ b/src/lib/es2020.d.ts
@@ -1,5 +1,7 @@
///
///
+///
+///
///
///
///
diff --git a/src/lib/es2020.date.d.ts b/src/lib/es2020.date.d.ts
new file mode 100644
index 0000000000000..c8ae7821362d7
--- /dev/null
+++ b/src/lib/es2020.date.d.ts
@@ -0,0 +1,24 @@
+///
+
+interface Date {
+ /**
+ * Converts a date and time to a string by using the current or specified locale.
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
+ * @param options An object that contains one or more properties that specify comparison options.
+ */
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
+
+ /**
+ * Converts a date to a string by using the current or specified locale.
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
+ * @param options An object that contains one or more properties that specify comparison options.
+ */
+ toLocaleDateString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
+
+ /**
+ * Converts a time to a string by using the current or specified locale.
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
+ * @param options An object that contains one or more properties that specify comparison options.
+ */
+ toLocaleTimeString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
+}
\ No newline at end of file
diff --git a/src/lib/es2020.intl.d.ts b/src/lib/es2020.intl.d.ts
index d340813d0c519..ba57d2e865807 100644
--- a/src/lib/es2020.intl.d.ts
+++ b/src/lib/es2020.intl.d.ts
@@ -58,6 +58,13 @@ declare namespace Intl {
*/
type BCP47LanguageTag = string;
+ /**
+ * The locale(s) to use
+ *
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
+ */
+ type LocalesArgument = UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[] | Locale | Locale[] | undefined;
+
/**
* An object with some or all of properties of `options` parameter
* of `Intl.RelativeTimeFormat` constructor.
diff --git a/src/lib/es2020.number.d.ts b/src/lib/es2020.number.d.ts
new file mode 100644
index 0000000000000..31e57e8aa5baa
--- /dev/null
+++ b/src/lib/es2020.number.d.ts
@@ -0,0 +1,10 @@
+///
+
+interface Number {
+ /**
+ * Converts a number to a string by using the current or specified locale.
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
+ * @param options An object that contains one or more properties that specify comparison options.
+ */
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string;
+}
diff --git a/src/lib/libs.json b/src/lib/libs.json
index e4434e89ea64a..0dbe57f36fa8d 100644
--- a/src/lib/libs.json
+++ b/src/lib/libs.json
@@ -44,11 +44,13 @@
"es2019.string",
"es2019.symbol",
"es2020.bigint",
+ "es2020.date",
"es2020.promise",
"es2020.sharedmemory",
"es2020.string",
"es2020.symbol.wellknown",
"es2020.intl",
+ "es2020.number",
"es2021.string",
"es2021.promise",
"es2021.weakref",
From 0b08e70c52354ac7633625b485da5f9d05761f85 Mon Sep 17 00:00:00 2001
From: jihndai <73680880+jihndai@users.noreply.github.com>
Date: Wed, 9 Feb 2022 13:38:02 -0400
Subject: [PATCH 2/4] update baselines
---
tests/baselines/reference/bigintWithLib.types | 16 ++++++++--------
tests/baselines/reference/es2020IntlAPIs.symbols | 2 +-
.../reactJsxReactResolvedNodeNext.trace.json | 4 ++++
.../reactJsxReactResolvedNodeNextEsm.trace.json | 4 ++++
.../does-not-add-color-when-NO_COLOR-is-set.js | 2 +-
...ped-when-host-can't-provide-terminal-width.js | 2 +-
...itStatus.DiagnosticsPresent_OutputsSkipped.js | 2 +-
.../typeGuardConstructorNarrowAny.symbols | 2 +-
.../typeGuardConstructorPrimitiveTypes.symbols | 6 +++---
9 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/tests/baselines/reference/bigintWithLib.types b/tests/baselines/reference/bigintWithLib.types
index 6009dd01cfc64..6e4376a0e24a2 100644
--- a/tests/baselines/reference/bigintWithLib.types
+++ b/tests/baselines/reference/bigintWithLib.types
@@ -66,26 +66,26 @@ stringVal = bigintVal.toLocaleString();
>stringVal = bigintVal.toLocaleString() : string
>stringVal : string
>bigintVal.toLocaleString() : string
->bigintVal.toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
+>bigintVal.toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
>bigintVal : bigint
->toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
+>toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
stringVal = bigintVal.toLocaleString('de-DE');
>stringVal = bigintVal.toLocaleString('de-DE') : string
>stringVal : string
>bigintVal.toLocaleString('de-DE') : string
->bigintVal.toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
+>bigintVal.toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
>bigintVal : bigint
->toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
+>toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
>'de-DE' : "de-DE"
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' });
>stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }) : string
>stringVal : string
>bigintVal.toLocaleString('de-DE', { style: 'currency' }) : string
->bigintVal.toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
+>bigintVal.toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
>bigintVal : bigint
->toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
+>toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
>'de-DE' : "de-DE"
>{ style: 'currency' } : { style: string; }
>style : string
@@ -95,9 +95,9 @@ stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EU
>stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) : string
>stringVal : string
>bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) : string
->bigintVal.toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
+>bigintVal.toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
>bigintVal : bigint
->toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
+>toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
>'de-DE' : "de-DE"
>{ style: 'currency', currency: 'EUR' } : { style: string; currency: string; }
>style : string
diff --git a/tests/baselines/reference/es2020IntlAPIs.symbols b/tests/baselines/reference/es2020IntlAPIs.symbols
index 895257b61d289..1738ba245b983 100644
--- a/tests/baselines/reference/es2020IntlAPIs.symbols
+++ b/tests/baselines/reference/es2020IntlAPIs.symbols
@@ -5,7 +5,7 @@ const count = 26254.39;
const date = new Date("2012-05-24");
>date : Symbol(date, Decl(es2020IntlAPIs.ts, 2, 5))
->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
+>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more)
function log(locale: string) {
>log : Symbol(log, Decl(es2020IntlAPIs.ts, 2, 36))
diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json
index ed76bdb1760bc..aff11ff7b3419 100644
--- a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json
+++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json
@@ -141,5 +141,9 @@
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
+ "File '/package.json' does not exist according to earlier cached lookups.",
+ "File 'package.json' does not exist according to earlier cached lookups.",
+ "File '/package.json' does not exist according to earlier cached lookups.",
+ "File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups."
]
\ No newline at end of file
diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json
index 7d2a5308b9e8b..783a70f3a4170 100644
--- a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json
+++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json
@@ -135,5 +135,9 @@
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
+ "File '/package.json' does not exist according to earlier cached lookups.",
+ "File 'package.json' does not exist according to earlier cached lookups.",
+ "File '/package.json' does not exist according to earlier cached lookups.",
+ "File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups."
]
\ No newline at end of file
diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js
index be6c3dace7fe0..219b3db4208c8 100644
--- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js
+++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js
@@ -78,7 +78,7 @@ default: undefined
--lib
Specify a set of bundled library declaration files that describe the target runtime environment.
-one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2020.bigint/esnext.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.object, es2022.string/esnext.string, esnext.intl
+one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.object, es2022.string/esnext.string, esnext.intl
default: undefined
--allowJs
diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js
index b4bc812a9da8e..df15b28f2aa93 100644
--- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js
+++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js
@@ -78,7 +78,7 @@ default: undefined
[94m--lib[39m
Specify a set of bundled library declaration files that describe the target runtime environment.
-one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2020.bigint/esnext.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.object, es2022.string/esnext.string, esnext.intl
+one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.object, es2022.string/esnext.string, esnext.intl
default: undefined
[94m--allowJs[39m
diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js
index b4bc812a9da8e..df15b28f2aa93 100644
--- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js
+++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js
@@ -78,7 +78,7 @@ default: undefined
[94m--lib[39m
Specify a set of bundled library declaration files that describe the target runtime environment.
-one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2020.bigint/esnext.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.object, es2022.string/esnext.string, esnext.intl
+one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.object, es2022.string/esnext.string, esnext.intl
default: undefined
[94m--allowJs[39m
diff --git a/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols b/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols
index 980e68c3f1cf9..05566a9104682 100644
--- a/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols
+++ b/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols
@@ -12,7 +12,7 @@ if (var1.constructor === String) {
}
if (var1.constructor === Number) {
>var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3))
->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
+>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --))
var1; // Number
>var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3))
diff --git a/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols b/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols
index 7258c198d18f7..281c056204288 100644
--- a/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols
+++ b/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols
@@ -16,7 +16,7 @@ if (var1.constructor === Number) {
>var1.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --))
>var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3))
>constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --))
->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
+>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --))
var1; // number
>var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3))
@@ -62,7 +62,7 @@ if (var1.constructor === BigInt) {
let var2: String | Number | Boolean | Symbol | BigInt;
>var2 : Symbol(var2, Decl(typeGuardConstructorPrimitiveTypes.ts, 22, 3))
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 6 more)
->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
+>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --))
>Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --))
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
@@ -80,7 +80,7 @@ if (var2.constructor === Number) {
>var2.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --))
>var2 : Symbol(var2, Decl(typeGuardConstructorPrimitiveTypes.ts, 22, 3))
>constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --))
->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
+>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --))
var2; // Number
>var2 : Symbol(var2, Decl(typeGuardConstructorPrimitiveTypes.ts, 22, 3))
From 5e5eeeb943e00f86be88ffc78b014c4292d4a6c1 Mon Sep 17 00:00:00 2001
From: jihndai <73680880+jihndai@users.noreply.github.com>
Date: Wed, 9 Feb 2022 13:49:11 -0400
Subject: [PATCH 3/4] add test for locales object arguments
---
.../reference/localesObjectArgument.js | 40 ++++++
.../reference/localesObjectArgument.symbols | 94 ++++++++++++++
.../reference/localesObjectArgument.types | 118 ++++++++++++++++++
.../es2020/localesObjectArgument.ts | 22 ++++
4 files changed, 274 insertions(+)
create mode 100644 tests/baselines/reference/localesObjectArgument.js
create mode 100644 tests/baselines/reference/localesObjectArgument.symbols
create mode 100644 tests/baselines/reference/localesObjectArgument.types
create mode 100644 tests/cases/conformance/es2020/localesObjectArgument.ts
diff --git a/tests/baselines/reference/localesObjectArgument.js b/tests/baselines/reference/localesObjectArgument.js
new file mode 100644
index 0000000000000..092a901e82ece
--- /dev/null
+++ b/tests/baselines/reference/localesObjectArgument.js
@@ -0,0 +1,40 @@
+//// [localesObjectArgument.ts]
+const enUS = new Intl.Locale("en-US");
+const deDE = new Intl.Locale("de-DE");
+const jaJP = new Intl.Locale("ja-JP");
+
+const now = new Date();
+const num = 1000;
+const bigint = 123456789123456789n;
+
+now.toLocaleString(enUS);
+now.toLocaleDateString(enUS);
+now.toLocaleTimeString(enUS);
+now.toLocaleString([deDE, jaJP]);
+now.toLocaleDateString([deDE, jaJP]);
+now.toLocaleTimeString([deDE, jaJP]);
+
+num.toLocaleString(enUS);
+num.toLocaleString([deDE, jaJP]);
+
+bigint.toLocaleString(enUS);
+bigint.toLocaleString([deDE, jaJP]);
+
+
+//// [localesObjectArgument.js]
+const enUS = new Intl.Locale("en-US");
+const deDE = new Intl.Locale("de-DE");
+const jaJP = new Intl.Locale("ja-JP");
+const now = new Date();
+const num = 1000;
+const bigint = 123456789123456789n;
+now.toLocaleString(enUS);
+now.toLocaleDateString(enUS);
+now.toLocaleTimeString(enUS);
+now.toLocaleString([deDE, jaJP]);
+now.toLocaleDateString([deDE, jaJP]);
+now.toLocaleTimeString([deDE, jaJP]);
+num.toLocaleString(enUS);
+num.toLocaleString([deDE, jaJP]);
+bigint.toLocaleString(enUS);
+bigint.toLocaleString([deDE, jaJP]);
diff --git a/tests/baselines/reference/localesObjectArgument.symbols b/tests/baselines/reference/localesObjectArgument.symbols
new file mode 100644
index 0000000000000..22b05ffd55f2e
--- /dev/null
+++ b/tests/baselines/reference/localesObjectArgument.symbols
@@ -0,0 +1,94 @@
+=== tests/cases/conformance/es2020/localesObjectArgument.ts ===
+const enUS = new Intl.Locale("en-US");
+>enUS : Symbol(enUS, Decl(localesObjectArgument.ts, 0, 5))
+>Intl.Locale : Symbol(Intl.Locale, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --))
+>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --))
+>Locale : Symbol(Intl.Locale, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --))
+
+const deDE = new Intl.Locale("de-DE");
+>deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5))
+>Intl.Locale : Symbol(Intl.Locale, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --))
+>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --))
+>Locale : Symbol(Intl.Locale, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --))
+
+const jaJP = new Intl.Locale("ja-JP");
+>jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5))
+>Intl.Locale : Symbol(Intl.Locale, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --))
+>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --))
+>Locale : Symbol(Intl.Locale, Decl(lib.es2020.intl.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --))
+
+const now = new Date();
+>now : Symbol(now, Decl(localesObjectArgument.ts, 4, 5))
+>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more)
+
+const num = 1000;
+>num : Symbol(num, Decl(localesObjectArgument.ts, 5, 5))
+
+const bigint = 123456789123456789n;
+>bigint : Symbol(bigint, Decl(localesObjectArgument.ts, 6, 5))
+
+now.toLocaleString(enUS);
+>now.toLocaleString : Symbol(Date.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>now : Symbol(now, Decl(localesObjectArgument.ts, 4, 5))
+>toLocaleString : Symbol(Date.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>enUS : Symbol(enUS, Decl(localesObjectArgument.ts, 0, 5))
+
+now.toLocaleDateString(enUS);
+>now.toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>now : Symbol(now, Decl(localesObjectArgument.ts, 4, 5))
+>toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>enUS : Symbol(enUS, Decl(localesObjectArgument.ts, 0, 5))
+
+now.toLocaleTimeString(enUS);
+>now.toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>now : Symbol(now, Decl(localesObjectArgument.ts, 4, 5))
+>toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>enUS : Symbol(enUS, Decl(localesObjectArgument.ts, 0, 5))
+
+now.toLocaleString([deDE, jaJP]);
+>now.toLocaleString : Symbol(Date.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>now : Symbol(now, Decl(localesObjectArgument.ts, 4, 5))
+>toLocaleString : Symbol(Date.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5))
+>jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5))
+
+now.toLocaleDateString([deDE, jaJP]);
+>now.toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>now : Symbol(now, Decl(localesObjectArgument.ts, 4, 5))
+>toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5))
+>jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5))
+
+now.toLocaleTimeString([deDE, jaJP]);
+>now.toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>now : Symbol(now, Decl(localesObjectArgument.ts, 4, 5))
+>toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.date.d.ts, --, --))
+>deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5))
+>jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5))
+
+num.toLocaleString(enUS);
+>num.toLocaleString : Symbol(Number.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --))
+>num : Symbol(num, Decl(localesObjectArgument.ts, 5, 5))
+>toLocaleString : Symbol(Number.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --))
+>enUS : Symbol(enUS, Decl(localesObjectArgument.ts, 0, 5))
+
+num.toLocaleString([deDE, jaJP]);
+>num.toLocaleString : Symbol(Number.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --))
+>num : Symbol(num, Decl(localesObjectArgument.ts, 5, 5))
+>toLocaleString : Symbol(Number.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --))
+>deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5))
+>jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5))
+
+bigint.toLocaleString(enUS);
+>bigint.toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
+>bigint : Symbol(bigint, Decl(localesObjectArgument.ts, 6, 5))
+>toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
+>enUS : Symbol(enUS, Decl(localesObjectArgument.ts, 0, 5))
+
+bigint.toLocaleString([deDE, jaJP]);
+>bigint.toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
+>bigint : Symbol(bigint, Decl(localesObjectArgument.ts, 6, 5))
+>toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
+>deDE : Symbol(deDE, Decl(localesObjectArgument.ts, 1, 5))
+>jaJP : Symbol(jaJP, Decl(localesObjectArgument.ts, 2, 5))
+
diff --git a/tests/baselines/reference/localesObjectArgument.types b/tests/baselines/reference/localesObjectArgument.types
new file mode 100644
index 0000000000000..a7a07a6ce6ab3
--- /dev/null
+++ b/tests/baselines/reference/localesObjectArgument.types
@@ -0,0 +1,118 @@
+=== tests/cases/conformance/es2020/localesObjectArgument.ts ===
+const enUS = new Intl.Locale("en-US");
+>enUS : Intl.Locale
+>new Intl.Locale("en-US") : Intl.Locale
+>Intl.Locale : new (tag?: string, options?: Intl.LocaleOptions) => Intl.Locale
+>Intl : typeof Intl
+>Locale : new (tag?: string, options?: Intl.LocaleOptions) => Intl.Locale
+>"en-US" : "en-US"
+
+const deDE = new Intl.Locale("de-DE");
+>deDE : Intl.Locale
+>new Intl.Locale("de-DE") : Intl.Locale
+>Intl.Locale : new (tag?: string, options?: Intl.LocaleOptions) => Intl.Locale
+>Intl : typeof Intl
+>Locale : new (tag?: string, options?: Intl.LocaleOptions) => Intl.Locale
+>"de-DE" : "de-DE"
+
+const jaJP = new Intl.Locale("ja-JP");
+>jaJP : Intl.Locale
+>new Intl.Locale("ja-JP") : Intl.Locale
+>Intl.Locale : new (tag?: string, options?: Intl.LocaleOptions) => Intl.Locale
+>Intl : typeof Intl
+>Locale : new (tag?: string, options?: Intl.LocaleOptions) => Intl.Locale
+>"ja-JP" : "ja-JP"
+
+const now = new Date();
+>now : Date
+>new Date() : Date
+>Date : DateConstructor
+
+const num = 1000;
+>num : 1000
+>1000 : 1000
+
+const bigint = 123456789123456789n;
+>bigint : 123456789123456789n
+>123456789123456789n : 123456789123456789n
+
+now.toLocaleString(enUS);
+>now.toLocaleString(enUS) : string
+>now.toLocaleString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>now : Date
+>toLocaleString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>enUS : Intl.Locale
+
+now.toLocaleDateString(enUS);
+>now.toLocaleDateString(enUS) : string
+>now.toLocaleDateString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>now : Date
+>toLocaleDateString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>enUS : Intl.Locale
+
+now.toLocaleTimeString(enUS);
+>now.toLocaleTimeString(enUS) : string
+>now.toLocaleTimeString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>now : Date
+>toLocaleTimeString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>enUS : Intl.Locale
+
+now.toLocaleString([deDE, jaJP]);
+>now.toLocaleString([deDE, jaJP]) : string
+>now.toLocaleString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>now : Date
+>toLocaleString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>[deDE, jaJP] : Intl.Locale[]
+>deDE : Intl.Locale
+>jaJP : Intl.Locale
+
+now.toLocaleDateString([deDE, jaJP]);
+>now.toLocaleDateString([deDE, jaJP]) : string
+>now.toLocaleDateString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>now : Date
+>toLocaleDateString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>[deDE, jaJP] : Intl.Locale[]
+>deDE : Intl.Locale
+>jaJP : Intl.Locale
+
+now.toLocaleTimeString([deDE, jaJP]);
+>now.toLocaleTimeString([deDE, jaJP]) : string
+>now.toLocaleTimeString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>now : Date
+>toLocaleTimeString : { (): string; (locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string; }
+>[deDE, jaJP] : Intl.Locale[]
+>deDE : Intl.Locale
+>jaJP : Intl.Locale
+
+num.toLocaleString(enUS);
+>num.toLocaleString(enUS) : string
+>num.toLocaleString : { (locales?: string | string[], options?: Intl.NumberFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string; }
+>num : 1000
+>toLocaleString : { (locales?: string | string[], options?: Intl.NumberFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string; }
+>enUS : Intl.Locale
+
+num.toLocaleString([deDE, jaJP]);
+>num.toLocaleString([deDE, jaJP]) : string
+>num.toLocaleString : { (locales?: string | string[], options?: Intl.NumberFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string; }
+>num : 1000
+>toLocaleString : { (locales?: string | string[], options?: Intl.NumberFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string; }
+>[deDE, jaJP] : Intl.Locale[]
+>deDE : Intl.Locale
+>jaJP : Intl.Locale
+
+bigint.toLocaleString(enUS);
+>bigint.toLocaleString(enUS) : string
+>bigint.toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
+>bigint : 123456789123456789n
+>toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
+>enUS : Intl.Locale
+
+bigint.toLocaleString([deDE, jaJP]);
+>bigint.toLocaleString([deDE, jaJP]) : string
+>bigint.toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
+>bigint : 123456789123456789n
+>toLocaleString : (locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions) => string
+>[deDE, jaJP] : Intl.Locale[]
+>deDE : Intl.Locale
+>jaJP : Intl.Locale
+
diff --git a/tests/cases/conformance/es2020/localesObjectArgument.ts b/tests/cases/conformance/es2020/localesObjectArgument.ts
new file mode 100644
index 0000000000000..a89e22ba91de7
--- /dev/null
+++ b/tests/cases/conformance/es2020/localesObjectArgument.ts
@@ -0,0 +1,22 @@
+// @target: es2020
+
+const enUS = new Intl.Locale("en-US");
+const deDE = new Intl.Locale("de-DE");
+const jaJP = new Intl.Locale("ja-JP");
+
+const now = new Date();
+const num = 1000;
+const bigint = 123456789123456789n;
+
+now.toLocaleString(enUS);
+now.toLocaleDateString(enUS);
+now.toLocaleTimeString(enUS);
+now.toLocaleString([deDE, jaJP]);
+now.toLocaleDateString([deDE, jaJP]);
+now.toLocaleTimeString([deDE, jaJP]);
+
+num.toLocaleString(enUS);
+num.toLocaleString([deDE, jaJP]);
+
+bigint.toLocaleString(enUS);
+bigint.toLocaleString([deDE, jaJP]);
From d6e44083c7f05373dc10db267f0cb5302e4cc8bc Mon Sep 17 00:00:00 2001
From: jihndai <73680880+jihndai@users.noreply.github.com>
Date: Mon, 28 Feb 2022 00:45:57 -0400
Subject: [PATCH 4/4] fix indentation
---
src/lib/es2020.date.d.ts | 36 ++++++++++++++++++------------------
src/lib/es2020.number.d.ts | 12 ++++++------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/lib/es2020.date.d.ts b/src/lib/es2020.date.d.ts
index c8ae7821362d7..07af7065f7391 100644
--- a/src/lib/es2020.date.d.ts
+++ b/src/lib/es2020.date.d.ts
@@ -1,24 +1,24 @@
///
interface Date {
- /**
- * Converts a date and time to a string by using the current or specified locale.
- * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
- * @param options An object that contains one or more properties that specify comparison options.
- */
- toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
+ /**
+ * Converts a date and time to a string by using the current or specified locale.
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
+ * @param options An object that contains one or more properties that specify comparison options.
+ */
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
- /**
- * Converts a date to a string by using the current or specified locale.
- * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
- * @param options An object that contains one or more properties that specify comparison options.
- */
- toLocaleDateString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
+ /**
+ * Converts a date to a string by using the current or specified locale.
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
+ * @param options An object that contains one or more properties that specify comparison options.
+ */
+ toLocaleDateString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
- /**
- * Converts a time to a string by using the current or specified locale.
- * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
- * @param options An object that contains one or more properties that specify comparison options.
- */
- toLocaleTimeString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
+ /**
+ * Converts a time to a string by using the current or specified locale.
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
+ * @param options An object that contains one or more properties that specify comparison options.
+ */
+ toLocaleTimeString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
}
\ No newline at end of file
diff --git a/src/lib/es2020.number.d.ts b/src/lib/es2020.number.d.ts
index 31e57e8aa5baa..ba61f3dfd0f5a 100644
--- a/src/lib/es2020.number.d.ts
+++ b/src/lib/es2020.number.d.ts
@@ -1,10 +1,10 @@
///
interface Number {
- /**
- * Converts a number to a string by using the current or specified locale.
- * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
- * @param options An object that contains one or more properties that specify comparison options.
- */
- toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string;
+ /**
+ * Converts a number to a string by using the current or specified locale.
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
+ * @param options An object that contains one or more properties that specify comparison options.
+ */
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string;
}