diff --git a/src/lib/esnext.d.ts b/src/lib/esnext.d.ts index b46f8df7620..9ea131785ba 100644 --- a/src/lib/esnext.d.ts +++ b/src/lib/esnext.d.ts @@ -1,3 +1,3 @@ -/// +/// /// /// diff --git a/tests/baselines/reference/bigintIndex.symbols b/tests/baselines/reference/bigintIndex.symbols index dff23a016ee..4a72dcc42c9 100644 --- a/tests/baselines/reference/bigintIndex.symbols +++ b/tests/baselines/reference/bigintIndex.symbols @@ -53,7 +53,7 @@ typedArray[bigNum] = 0xAA; // should error typedArray[String(bigNum)] = 0xAA; >typedArray : Symbol(typedArray, Decl(a.ts, 17, 5)) ->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 3 more) +>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 4 more) >bigNum : Symbol(bigNum, Decl(a.ts, 16, 5)) typedArray["1"] = 0xBB; diff --git a/tests/baselines/reference/regexMatchAll-esnext.js b/tests/baselines/reference/regexMatchAll-esnext.js new file mode 100644 index 00000000000..545a78fcbec --- /dev/null +++ b/tests/baselines/reference/regexMatchAll-esnext.js @@ -0,0 +1,10 @@ +//// [regexMatchAll-esnext.ts] +const matches = /\w/g[Symbol.matchAll]("matchAll"); +const array = [...matches]; +const { index, input } = array[0]; + + +//// [regexMatchAll-esnext.js] +const matches = /\w/g[Symbol.matchAll]("matchAll"); +const array = [...matches]; +const { index, input } = array[0]; diff --git a/tests/baselines/reference/regexMatchAll-esnext.symbols b/tests/baselines/reference/regexMatchAll-esnext.symbols new file mode 100644 index 00000000000..374d076c4d0 --- /dev/null +++ b/tests/baselines/reference/regexMatchAll-esnext.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/regexMatchAll-esnext.ts === +const matches = /\w/g[Symbol.matchAll]("matchAll"); +>matches : Symbol(matches, Decl(regexMatchAll-esnext.ts, 0, 5)) +>Symbol.matchAll : Symbol(SymbolConstructor.matchAll, Decl(lib.es2020.symbol.wellknown.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, --, --)) +>matchAll : Symbol(SymbolConstructor.matchAll, Decl(lib.es2020.symbol.wellknown.d.ts, --, --)) + +const array = [...matches]; +>array : Symbol(array, Decl(regexMatchAll-esnext.ts, 1, 5)) +>matches : Symbol(matches, Decl(regexMatchAll-esnext.ts, 0, 5)) + +const { index, input } = array[0]; +>index : Symbol(index, Decl(regexMatchAll-esnext.ts, 2, 7)) +>input : Symbol(input, Decl(regexMatchAll-esnext.ts, 2, 14)) +>array : Symbol(array, Decl(regexMatchAll-esnext.ts, 1, 5)) + diff --git a/tests/baselines/reference/regexMatchAll-esnext.types b/tests/baselines/reference/regexMatchAll-esnext.types new file mode 100644 index 00000000000..9a902b60000 --- /dev/null +++ b/tests/baselines/reference/regexMatchAll-esnext.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/regexMatchAll-esnext.ts === +const matches = /\w/g[Symbol.matchAll]("matchAll"); +>matches : IterableIterator +>/\w/g[Symbol.matchAll]("matchAll") : IterableIterator +>/\w/g[Symbol.matchAll] : (str: string) => IterableIterator +>/\w/g : RegExp +>Symbol.matchAll : symbol +>Symbol : SymbolConstructor +>matchAll : symbol +>"matchAll" : "matchAll" + +const array = [...matches]; +>array : RegExpMatchArray[] +>[...matches] : RegExpMatchArray[] +>...matches : RegExpMatchArray +>matches : IterableIterator + +const { index, input } = array[0]; +>index : number +>input : string +>array[0] : RegExpMatchArray +>array : RegExpMatchArray[] +>0 : 0 + diff --git a/tests/cases/compiler/regexMatchAll-esnext.ts b/tests/cases/compiler/regexMatchAll-esnext.ts new file mode 100644 index 00000000000..7c72b652540 --- /dev/null +++ b/tests/cases/compiler/regexMatchAll-esnext.ts @@ -0,0 +1,5 @@ +// @target: esnext + +const matches = /\w/g[Symbol.matchAll]("matchAll"); +const array = [...matches]; +const { index, input } = array[0];