Skip to content

Commit 006ae33

Browse files
authored
Add es2018.intl ref to es2020.intl (microsoft#49152)
* Add es2018.intl ref to es2020.intl es2020.intl refers to NumberFormatPartTypes declared in es2018.intl as of microsoft#46508. I'm not sure how to test this; it repros on Definitely Typed in types/ndarray, but when I copy the same files into a compiler test it passes without a problem. * Add a test that shows the change works It doesn't actually show that the original bug has been fixed, though.
1 parent 408c760 commit 006ae33

6 files changed

+29
-4
lines changed

src/lib/es2020.intl.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference lib="es2018.intl" />
12
declare namespace Intl {
23

34
/**

tests/baselines/reference/es2020IntlAPIs.errors.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,22 @@ tests/cases/conformance/es2020/es2020IntlAPIs.ts(50,29): error TS2345: Argument
5353
new Intl.Locale(); // should error
5454
~~~~~~~~~~~~~~~~~
5555
!!! error TS2554: Expected 1-2 arguments, but got 0.
56-
!!! related TS6210 /.ts/lib.es2020.intl.d.ts:335:14: An argument for 'tag' was not provided.
56+
!!! related TS6210 /.ts/lib.es2020.intl.d.ts:336:14: An argument for 'tag' was not provided.
5757
new Intl.Locale(new Intl.Locale('en-US'));
5858

5959
new Intl.DisplayNames(); // TypeError: invalid_argument
6060
~~~~~~~~~~~~~~~~~~~~~~~
6161
!!! error TS2554: Expected 2 arguments, but got 0.
62-
!!! related TS6210 /.ts/lib.es2020.intl.d.ts:414:13: An argument for 'locales' was not provided.
62+
!!! related TS6210 /.ts/lib.es2020.intl.d.ts:415:13: An argument for 'locales' was not provided.
6363
new Intl.DisplayNames('en'); // TypeError: invalid_argument
6464
~~~~~~~~~~~~~~~~~~~~~~~~~~~
6565
!!! error TS2554: Expected 2 arguments, but got 1.
66-
!!! related TS6210 /.ts/lib.es2020.intl.d.ts:414:39: An argument for 'options' was not provided.
66+
!!! related TS6210 /.ts/lib.es2020.intl.d.ts:415:39: An argument for 'options' was not provided.
6767
new Intl.DisplayNames('en', {}); // TypeError: invalid_argument
6868
~~
6969
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'DisplayNamesOptions'.
7070
!!! error TS2345: Property 'type' is missing in type '{}' but required in type 'DisplayNamesOptions'.
71-
!!! related TS2728 /.ts/lib.es2020.intl.d.ts:357:9: 'type' is declared here.
71+
!!! related TS2728 /.ts/lib.es2020.intl.d.ts:358:9: 'type' is declared here.
7272
console.log((new Intl.DisplayNames(undefined, {type: 'language'})).of('en-GB')); // "British English"
7373

7474
const localesArg = ["es-ES", new Intl.Locale("en-US")];
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//// [esnext.bigintIncludesNumberFormatPartTypes.ts]
2+
/// <reference lib="esnext.bigint" />
3+
var t: Intl.NumberFormatPartTypes
4+
5+
6+
//// [esnext.bigintIncludesNumberFormatPartTypes.js]
7+
/// <reference lib="esnext.bigint" />
8+
var t;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
=== tests/cases/compiler/esnext.bigintIncludesNumberFormatPartTypes.ts ===
2+
/// <reference lib="esnext.bigint" />
3+
var t: Intl.NumberFormatPartTypes
4+
>t : Symbol(t, Decl(esnext.bigintIncludesNumberFormatPartTypes.ts, 1, 3))
5+
>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --))
6+
>NumberFormatPartTypes : Symbol(Intl.NumberFormatPartTypes, Decl(lib.es2018.intl.d.ts, --, --))
7+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
=== tests/cases/compiler/esnext.bigintIncludesNumberFormatPartTypes.ts ===
2+
/// <reference lib="esnext.bigint" />
3+
var t: Intl.NumberFormatPartTypes
4+
>t : Intl.NumberFormatPartTypes
5+
>Intl : any
6+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// @lib: es6
2+
/// <reference lib="esnext.bigint" />
3+
var t: Intl.NumberFormatPartTypes

0 commit comments

Comments
 (0)