diff --git a/tsc/internal/bundled/libs/lib.es2023.intl.d.ts b/tsc/internal/bundled/libs/lib.es2023.intl.d.ts index 5ea242308f044..c64700effc00d 100644 --- a/tsc/internal/bundled/libs/lib.es2023.intl.d.ts +++ b/tsc/internal/bundled/libs/lib.es2023.intl.d.ts @@ -59,4 +59,8 @@ declare namespace Intl { formatRange(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): string; formatRangeToParts(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): NumberRangeFormatPart[]; } + + interface PluralRules { + selectRange(start: number, end: number): LDMLPluralRule; + } } diff --git a/tsc/testdata/baselines/reference/conformance/intlPluralRulesSelectRangeES2023.js b/tsc/testdata/baselines/reference/conformance/intlPluralRulesSelectRangeES2023.js new file mode 100644 index 0000000000000..85a305308feff --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/intlPluralRulesSelectRangeES2023.js @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/es2023/intlPluralRulesSelectRangeES2023.ts] //// + +//// [intlPluralRulesSelectRangeES2023.ts] +const pr = new Intl.PluralRules("en-US"); +const category = pr.selectRange(1, 2); + +const exact: Intl.LDMLPluralRule = category; + + +//// [intlPluralRulesSelectRangeES2023.js] +"use strict"; +const pr = new Intl.PluralRules("en-US"); +const category = pr.selectRange(1, 2); +const exact = category; diff --git a/tsc/testdata/baselines/reference/conformance/intlPluralRulesSelectRangeES2023.symbols b/tsc/testdata/baselines/reference/conformance/intlPluralRulesSelectRangeES2023.symbols new file mode 100644 index 0000000000000..c16e36b8166e8 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/intlPluralRulesSelectRangeES2023.symbols @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/es2023/intlPluralRulesSelectRangeES2023.ts] //// + +=== intlPluralRulesSelectRangeES2023.ts === +const pr = new Intl.PluralRules("en-US"); +>pr : Symbol(pr, Decl(intlPluralRulesSelectRangeES2023.ts, 0, 5)) +>Intl.PluralRules : Symbol(Intl.PluralRules, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 5 more) +>PluralRules : Symbol(Intl.PluralRules, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2023.intl.d.ts, --, --)) + +const category = pr.selectRange(1, 2); +>category : Symbol(category, Decl(intlPluralRulesSelectRangeES2023.ts, 1, 5)) +>pr.selectRange : Symbol(Intl.PluralRules.selectRange, Decl(lib.es2023.intl.d.ts, --, --)) +>pr : Symbol(pr, Decl(intlPluralRulesSelectRangeES2023.ts, 0, 5)) +>selectRange : Symbol(Intl.PluralRules.selectRange, Decl(lib.es2023.intl.d.ts, --, --)) + +const exact: Intl.LDMLPluralRule = category; +>exact : Symbol(exact, Decl(intlPluralRulesSelectRangeES2023.ts, 3, 5)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 5 more) +>LDMLPluralRule : Symbol(Intl.LDMLPluralRule, Decl(lib.es2018.intl.d.ts, --, --)) +>category : Symbol(category, Decl(intlPluralRulesSelectRangeES2023.ts, 1, 5)) + diff --git a/tsc/testdata/baselines/reference/conformance/intlPluralRulesSelectRangeES2023.types b/tsc/testdata/baselines/reference/conformance/intlPluralRulesSelectRangeES2023.types new file mode 100644 index 0000000000000..85e5d61d9fcce --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/intlPluralRulesSelectRangeES2023.types @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/es2023/intlPluralRulesSelectRangeES2023.ts] //// + +=== intlPluralRulesSelectRangeES2023.ts === +const pr = new Intl.PluralRules("en-US"); +>pr : Intl.PluralRules +>new Intl.PluralRules("en-US") : Intl.PluralRules +>Intl.PluralRules : Intl.PluralRulesConstructor +>Intl : typeof Intl +>PluralRules : Intl.PluralRulesConstructor +>"en-US" : "en-US" + +const category = pr.selectRange(1, 2); +>category : Intl.LDMLPluralRule +>pr.selectRange(1, 2) : Intl.LDMLPluralRule +>pr.selectRange : (start: number, end: number) => Intl.LDMLPluralRule +>pr : Intl.PluralRules +>selectRange : (start: number, end: number) => Intl.LDMLPluralRule +>1 : 1 +>2 : 2 + +const exact: Intl.LDMLPluralRule = category; +>exact : Intl.LDMLPluralRule +>Intl : any +>category : Intl.LDMLPluralRule + diff --git a/tsc/testdata/tests/cases/conformance/es2023/intlPluralRulesSelectRangeES2023.ts b/tsc/testdata/tests/cases/conformance/es2023/intlPluralRulesSelectRangeES2023.ts new file mode 100644 index 0000000000000..595c9dd33e860 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/es2023/intlPluralRulesSelectRangeES2023.ts @@ -0,0 +1,8 @@ +// @target: es2022 +// @lib: es2022,es2023.intl +// @strict: true + +const pr = new Intl.PluralRules("en-US"); +const category = pr.selectRange(1, 2); + +const exact: Intl.LDMLPluralRule = category;