Skip to content

Commit 36e540a

Browse files
committed
fix(intl): add selectRange to Intl.PluralRules in es2023.intl
1 parent 55423ab commit 36e540a

5 files changed

Lines changed: 88 additions & 0 deletions

File tree

src/lib/es2023.intl.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ declare namespace Intl {
4343
formatRange(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): string;
4444
formatRangeToParts(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): NumberRangeFormatPart[];
4545
}
46+
47+
interface PluralRules {
48+
selectRange(start: number, end: number): LDMLPluralRule;
49+
}
4650
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//// [tests/cases/conformance/es2023/intlPluralRulesSelectRangeES2023.ts] ////
2+
3+
//// [intlPluralRulesSelectRangeES2023.ts]
4+
const pr = new Intl.PluralRules("en-US");
5+
const category = pr.selectRange(1, 2);
6+
7+
const exact: Intl.LDMLPluralRule = category;
8+
9+
10+
//// [intlPluralRulesSelectRangeES2023.js]
11+
"use strict";
12+
const pr = new Intl.PluralRules("en-US");
13+
const category = pr.selectRange(1, 2);
14+
const exact = category;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//// [tests/cases/conformance/es2023/intlPluralRulesSelectRangeES2023.ts] ////
2+
3+
=== intlPluralRulesSelectRangeES2023.ts ===
4+
const pr = new Intl.PluralRules("en-US");
5+
>pr : Symbol(pr, Decl(intlPluralRulesSelectRangeES2023.ts, 0, 5))
6+
>Intl.PluralRules : Symbol(Intl.PluralRules, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2023.intl.d.ts, --, --))
7+
>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)
8+
>PluralRules : Symbol(Intl.PluralRules, Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2023.intl.d.ts, --, --))
9+
10+
const category = pr.selectRange(1, 2);
11+
>category : Symbol(category, Decl(intlPluralRulesSelectRangeES2023.ts, 1, 5))
12+
>pr.selectRange : Symbol(Intl.PluralRules.selectRange, Decl(lib.es2023.intl.d.ts, --, --))
13+
>pr : Symbol(pr, Decl(intlPluralRulesSelectRangeES2023.ts, 0, 5))
14+
>selectRange : Symbol(Intl.PluralRules.selectRange, Decl(lib.es2023.intl.d.ts, --, --))
15+
16+
const exact: Intl.LDMLPluralRule = category;
17+
>exact : Symbol(exact, Decl(intlPluralRulesSelectRangeES2023.ts, 3, 5))
18+
>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)
19+
>LDMLPluralRule : Symbol(Intl.LDMLPluralRule, Decl(lib.es2018.intl.d.ts, --, --))
20+
>category : Symbol(category, Decl(intlPluralRulesSelectRangeES2023.ts, 1, 5))
21+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//// [tests/cases/conformance/es2023/intlPluralRulesSelectRangeES2023.ts] ////
2+
3+
=== intlPluralRulesSelectRangeES2023.ts ===
4+
const pr = new Intl.PluralRules("en-US");
5+
>pr : Intl.PluralRules
6+
> : ^^^^^^^^^^^^^^^^
7+
>new Intl.PluralRules("en-US") : Intl.PluralRules
8+
> : ^^^^^^^^^^^^^^^^
9+
>Intl.PluralRules : Intl.PluralRulesConstructor
10+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
11+
>Intl : typeof Intl
12+
> : ^^^^^^^^^^^
13+
>PluralRules : Intl.PluralRulesConstructor
14+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
>"en-US" : "en-US"
16+
> : ^^^^^^^
17+
18+
const category = pr.selectRange(1, 2);
19+
>category : Intl.LDMLPluralRule
20+
> : ^^^^^^^^^^^^^^^^^^^
21+
>pr.selectRange(1, 2) : Intl.LDMLPluralRule
22+
> : ^^^^^^^^^^^^^^^^^^^
23+
>pr.selectRange : (start: number, end: number) => Intl.LDMLPluralRule
24+
> : ^ ^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^
25+
>pr : Intl.PluralRules
26+
> : ^^^^^^^^^^^^^^^^
27+
>selectRange : (start: number, end: number) => Intl.LDMLPluralRule
28+
> : ^ ^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^
29+
>1 : 1
30+
> : ^
31+
>2 : 2
32+
> : ^
33+
34+
const exact: Intl.LDMLPluralRule = category;
35+
>exact : Intl.LDMLPluralRule
36+
> : ^^^^^^^^^^^^^^^^^^^
37+
>Intl : any
38+
> : ^^^
39+
>category : Intl.LDMLPluralRule
40+
> : ^^^^^^^^^^^^^^^^^^^
41+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// @target: es2022
2+
// @lib: es2022,es2023.intl
3+
// @strict: true
4+
5+
const pr = new Intl.PluralRules("en-US");
6+
const category = pr.selectRange(1, 2);
7+
8+
const exact: Intl.LDMLPluralRule = category;

0 commit comments

Comments
 (0)