diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 20f5d7a6b4876..408fa99683a0a 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -212,7 +212,9 @@ const libEntries: [string, string][] = [ ["es2022.string", "lib.es2022.string.d.ts"], ["es2022.regexp", "lib.es2022.regexp.d.ts"], ["es2023.array", "lib.es2023.array.d.ts"], + ["es2023.collection", "lib.es2023.collection.d.ts"], ["esnext.array", "lib.es2023.array.d.ts"], + ["esnext.collection", "lib.es2023.collection.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"], ["esnext.intl", "lib.esnext.intl.d.ts"], diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 6e9db25bbba34..1ed8641a40904 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1225,6 +1225,8 @@ export namespace Completion { varEntry("Float64Array"), interfaceEntry("Float64ArrayConstructor"), moduleEntry("Intl"), + typeEntry("WeakKey"), + interfaceEntry("WeakKeyTypes"), ]; export const globalThisEntry: ExpectedCompletionEntry = { diff --git a/src/lib/es2015.collection.d.ts b/src/lib/es2015.collection.d.ts index fd4a752cd57e9..752d0500b0933 100644 --- a/src/lib/es2015.collection.d.ts +++ b/src/lib/es2015.collection.d.ts @@ -42,7 +42,7 @@ interface ReadonlyMap { readonly size: number; } -interface WeakMap { +interface WeakMap { /** * Removes the specified element from the WeakMap. * @returns true if the element was successfully removed, or false if it was not present. @@ -58,14 +58,14 @@ interface WeakMap { has(key: K): boolean; /** * Adds a new element with a specified key and value. - * @param key Must be an object. + * @param key Must be an object or symbol. */ set(key: K, value: V): this; } interface WeakMapConstructor { - new (entries?: readonly (readonly [K, V])[] | null): WeakMap; - readonly prototype: WeakMap; + new (entries?: readonly [K, V][] | null): WeakMap; + readonly prototype: WeakMap; } declare var WeakMap: WeakMapConstructor; @@ -107,9 +107,9 @@ interface ReadonlySet { readonly size: number; } -interface WeakSet { +interface WeakSet { /** - * Appends a new object to the end of the WeakSet. + * Appends a new value to the end of the WeakSet. */ add(value: T): this; /** @@ -118,13 +118,13 @@ interface WeakSet { */ delete(value: T): boolean; /** - * @returns a boolean indicating whether an object exists in the WeakSet or not. + * @returns a boolean indicating whether a value exists in the WeakSet or not. */ has(value: T): boolean; } interface WeakSetConstructor { - new (values?: readonly T[] | null): WeakSet; - readonly prototype: WeakSet; + new (values?: readonly T[] | null): WeakSet; + readonly prototype: WeakSet; } declare var WeakSet: WeakSetConstructor; diff --git a/src/lib/es2015.iterable.d.ts b/src/lib/es2015.iterable.d.ts index f1fb454f980b1..c7b7afa72119d 100644 --- a/src/lib/es2015.iterable.d.ts +++ b/src/lib/es2015.iterable.d.ts @@ -141,10 +141,10 @@ interface MapConstructor { new (iterable?: Iterable | null): Map; } -interface WeakMap { } +interface WeakMap { } interface WeakMapConstructor { - new (iterable: Iterable): WeakMap; + new (iterable: Iterable): WeakMap; } interface Set { @@ -189,10 +189,10 @@ interface SetConstructor { new (iterable?: Iterable | null): Set; } -interface WeakSet { } +interface WeakSet { } interface WeakSetConstructor { - new (iterable: Iterable): WeakSet; + new (iterable: Iterable): WeakSet; } interface Promise { } diff --git a/src/lib/es2015.symbol.wellknown.d.ts b/src/lib/es2015.symbol.wellknown.d.ts index 2c1cfb67b2c6d..cf6ccef52b89f 100644 --- a/src/lib/es2015.symbol.wellknown.d.ts +++ b/src/lib/es2015.symbol.wellknown.d.ts @@ -119,7 +119,7 @@ interface Map { readonly [Symbol.toStringTag]: string; } -interface WeakMap { +interface WeakMap { readonly [Symbol.toStringTag]: string; } @@ -127,7 +127,7 @@ interface Set { readonly [Symbol.toStringTag]: string; } -interface WeakSet { +interface WeakSet { readonly [Symbol.toStringTag]: string; } diff --git a/src/lib/es2021.weakref.d.ts b/src/lib/es2021.weakref.d.ts index d36ddb6a19cfd..b8aac14ae51f9 100644 --- a/src/lib/es2021.weakref.d.ts +++ b/src/lib/es2021.weakref.d.ts @@ -1,9 +1,10 @@ -interface WeakRef { +interface WeakRef { readonly [Symbol.toStringTag]: "WeakRef"; /** - * Returns the WeakRef instance's target object, or undefined if the target object has been + * Returns the WeakRef instance's target value, or undefined if the target value has been * reclaimed. + * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible. */ deref(): T | undefined; } @@ -12,10 +13,11 @@ interface WeakRefConstructor { readonly prototype: WeakRef; /** - * Creates a WeakRef instance for the given target object. - * @param target The target object for the WeakRef instance. + * Creates a WeakRef instance for the given target value. + * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible. + * @param target The target value for the WeakRef instance. */ - new(target: T): WeakRef; + new(target: T): WeakRef; } declare var WeakRef: WeakRefConstructor; @@ -24,22 +26,23 @@ interface FinalizationRegistry { readonly [Symbol.toStringTag]: "FinalizationRegistry"; /** - * Registers an object with the registry. - * @param target The target object to register. - * @param heldValue The value to pass to the finalizer for this object. This cannot be the - * target object. + * Registers a value with the registry. + * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible. + * @param target The target value to register. + * @param heldValue The value to pass to the finalizer for this value. This cannot be the + * target value. * @param unregisterToken The token to pass to the unregister method to unregister the target - * object. If provided (and not undefined), this must be an object. If not provided, the target - * cannot be unregistered. + * value. If not provided, the target cannot be unregistered. */ - register(target: object, heldValue: T, unregisterToken?: object): void; + register(target: WeakKey, heldValue: T, unregisterToken?: WeakKey): void; /** - * Unregisters an object from the registry. + * Unregisters a value from the registry. + * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible. * @param unregisterToken The token that was used as the unregisterToken argument when calling - * register to register the target object. + * register to register the target value. */ - unregister(unregisterToken: object): void; + unregister(unregisterToken: WeakKey): void; } interface FinalizationRegistryConstructor { @@ -47,7 +50,7 @@ interface FinalizationRegistryConstructor { /** * Creates a finalization registry with an associated cleanup callback - * @param cleanupCallback The callback to call after an object in the registry has been reclaimed. + * @param cleanupCallback The callback to call after a value in the registry has been reclaimed. */ new(cleanupCallback: (heldValue: T) => void): FinalizationRegistry; } diff --git a/src/lib/es2023.collection.d.ts b/src/lib/es2023.collection.d.ts new file mode 100644 index 0000000000000..77545a0a415c3 --- /dev/null +++ b/src/lib/es2023.collection.d.ts @@ -0,0 +1,3 @@ +interface WeakKeyTypes { + symbol: symbol; +} diff --git a/src/lib/es2023.d.ts b/src/lib/es2023.d.ts index 02292dc39546f..5c45f807e08a8 100644 --- a/src/lib/es2023.d.ts +++ b/src/lib/es2023.d.ts @@ -1,2 +1,3 @@ /// /// +/// diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 0e7c3e18077bc..24ee15cd9dedd 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1647,6 +1647,15 @@ type Uncapitalize = intrinsic; */ interface ThisType { } +/** + * Stores types to be used with WeakSet, WeakMap, WeakRef, and FinalizationRegistry + */ +interface WeakKeyTypes { + object: object; +} + +type WeakKey = WeakKeyTypes[keyof WeakKeyTypes]; + /** * Represents a raw buffer of binary data, which is used to store data for the * different typed arrays. ArrayBuffers cannot be read from or written to directly, diff --git a/src/lib/libs.json b/src/lib/libs.json index 335251ae5bb30..a7a07d9d2191b 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -66,6 +66,7 @@ "es2022.string", "es2022.regexp", "es2023.array", + "es2023.collection", "esnext.intl", "decorators", "decorators.legacy", diff --git a/tests/baselines/reference/acceptSymbolAsWeakType.js b/tests/baselines/reference/acceptSymbolAsWeakType.js new file mode 100644 index 0000000000000..8c0911a9329a8 --- /dev/null +++ b/tests/baselines/reference/acceptSymbolAsWeakType.js @@ -0,0 +1,40 @@ +//// [tests/cases/compiler/acceptSymbolAsWeakType.ts] //// + +//// [acceptSymbolAsWeakType.ts] +const s: symbol = Symbol('s'); + +const ws = new WeakSet([s]); +ws.add(s); +ws.has(s); +ws.delete(s); + +const wm = new WeakMap([[s, false]]); +wm.set(s, true); +wm.has(s); +wm.get(s); +wm.delete(s); + +const wr = new WeakRef(s); +wr.deref(); + +const f = new FinalizationRegistry(() => {}); +f.register(s, null); +f.unregister(s); + +//// [acceptSymbolAsWeakType.js] +"use strict"; +const s = Symbol('s'); +const ws = new WeakSet([s]); +ws.add(s); +ws.has(s); +ws.delete(s); +const wm = new WeakMap([[s, false]]); +wm.set(s, true); +wm.has(s); +wm.get(s); +wm.delete(s); +const wr = new WeakRef(s); +wr.deref(); +const f = new FinalizationRegistry(() => { }); +f.register(s, null); +f.unregister(s); diff --git a/tests/baselines/reference/acceptSymbolAsWeakType.symbols b/tests/baselines/reference/acceptSymbolAsWeakType.symbols new file mode 100644 index 0000000000000..21ec0d78f549a --- /dev/null +++ b/tests/baselines/reference/acceptSymbolAsWeakType.symbols @@ -0,0 +1,85 @@ +//// [tests/cases/compiler/acceptSymbolAsWeakType.ts] //// + +=== acceptSymbolAsWeakType.ts === +const s: symbol = Symbol('s'); +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) +>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, --, --)) + +const ws = new WeakSet([s]); +>ws : Symbol(ws, Decl(acceptSymbolAsWeakType.ts, 2, 5)) +>WeakSet : Symbol(WeakSet, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +ws.add(s); +>ws.add : Symbol(WeakSet.add, Decl(lib.es2015.collection.d.ts, --, --)) +>ws : Symbol(ws, Decl(acceptSymbolAsWeakType.ts, 2, 5)) +>add : Symbol(WeakSet.add, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +ws.has(s); +>ws.has : Symbol(WeakSet.has, Decl(lib.es2015.collection.d.ts, --, --)) +>ws : Symbol(ws, Decl(acceptSymbolAsWeakType.ts, 2, 5)) +>has : Symbol(WeakSet.has, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +ws.delete(s); +>ws.delete : Symbol(WeakSet.delete, Decl(lib.es2015.collection.d.ts, --, --)) +>ws : Symbol(ws, Decl(acceptSymbolAsWeakType.ts, 2, 5)) +>delete : Symbol(WeakSet.delete, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +const wm = new WeakMap([[s, false]]); +>wm : Symbol(wm, Decl(acceptSymbolAsWeakType.ts, 7, 5)) +>WeakMap : Symbol(WeakMap, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +wm.set(s, true); +>wm.set : Symbol(WeakMap.set, Decl(lib.es2015.collection.d.ts, --, --)) +>wm : Symbol(wm, Decl(acceptSymbolAsWeakType.ts, 7, 5)) +>set : Symbol(WeakMap.set, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +wm.has(s); +>wm.has : Symbol(WeakMap.has, Decl(lib.es2015.collection.d.ts, --, --)) +>wm : Symbol(wm, Decl(acceptSymbolAsWeakType.ts, 7, 5)) +>has : Symbol(WeakMap.has, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +wm.get(s); +>wm.get : Symbol(WeakMap.get, Decl(lib.es2015.collection.d.ts, --, --)) +>wm : Symbol(wm, Decl(acceptSymbolAsWeakType.ts, 7, 5)) +>get : Symbol(WeakMap.get, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +wm.delete(s); +>wm.delete : Symbol(WeakMap.delete, Decl(lib.es2015.collection.d.ts, --, --)) +>wm : Symbol(wm, Decl(acceptSymbolAsWeakType.ts, 7, 5)) +>delete : Symbol(WeakMap.delete, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +const wr = new WeakRef(s); +>wr : Symbol(wr, Decl(acceptSymbolAsWeakType.ts, 13, 5)) +>WeakRef : Symbol(WeakRef, Decl(lib.es2021.weakref.d.ts, --, --), Decl(lib.es2021.weakref.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +wr.deref(); +>wr.deref : Symbol(WeakRef.deref, Decl(lib.es2021.weakref.d.ts, --, --)) +>wr : Symbol(wr, Decl(acceptSymbolAsWeakType.ts, 13, 5)) +>deref : Symbol(WeakRef.deref, Decl(lib.es2021.weakref.d.ts, --, --)) + +const f = new FinalizationRegistry(() => {}); +>f : Symbol(f, Decl(acceptSymbolAsWeakType.ts, 16, 5)) +>FinalizationRegistry : Symbol(FinalizationRegistry, Decl(lib.es2021.weakref.d.ts, --, --), Decl(lib.es2021.weakref.d.ts, --, --)) + +f.register(s, null); +>f.register : Symbol(FinalizationRegistry.register, Decl(lib.es2021.weakref.d.ts, --, --)) +>f : Symbol(f, Decl(acceptSymbolAsWeakType.ts, 16, 5)) +>register : Symbol(FinalizationRegistry.register, Decl(lib.es2021.weakref.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + +f.unregister(s); +>f.unregister : Symbol(FinalizationRegistry.unregister, Decl(lib.es2021.weakref.d.ts, --, --)) +>f : Symbol(f, Decl(acceptSymbolAsWeakType.ts, 16, 5)) +>unregister : Symbol(FinalizationRegistry.unregister, Decl(lib.es2021.weakref.d.ts, --, --)) +>s : Symbol(s, Decl(acceptSymbolAsWeakType.ts, 0, 5)) + diff --git a/tests/baselines/reference/acceptSymbolAsWeakType.types b/tests/baselines/reference/acceptSymbolAsWeakType.types new file mode 100644 index 0000000000000..f026b03be23d5 --- /dev/null +++ b/tests/baselines/reference/acceptSymbolAsWeakType.types @@ -0,0 +1,107 @@ +//// [tests/cases/compiler/acceptSymbolAsWeakType.ts] //// + +=== acceptSymbolAsWeakType.ts === +const s: symbol = Symbol('s'); +>s : symbol +>Symbol('s') : unique symbol +>Symbol : SymbolConstructor +>'s' : "s" + +const ws = new WeakSet([s]); +>ws : WeakSet +>new WeakSet([s]) : WeakSet +>WeakSet : WeakSetConstructor +>[s] : symbol[] +>s : symbol + +ws.add(s); +>ws.add(s) : WeakSet +>ws.add : (value: symbol) => WeakSet +>ws : WeakSet +>add : (value: symbol) => WeakSet +>s : symbol + +ws.has(s); +>ws.has(s) : boolean +>ws.has : (value: symbol) => boolean +>ws : WeakSet +>has : (value: symbol) => boolean +>s : symbol + +ws.delete(s); +>ws.delete(s) : boolean +>ws.delete : (value: symbol) => boolean +>ws : WeakSet +>delete : (value: symbol) => boolean +>s : symbol + +const wm = new WeakMap([[s, false]]); +>wm : WeakMap +>new WeakMap([[s, false]]) : WeakMap +>WeakMap : WeakMapConstructor +>[[s, false]] : [symbol, false][] +>[s, false] : [symbol, false] +>s : symbol +>false : false + +wm.set(s, true); +>wm.set(s, true) : WeakMap +>wm.set : (key: symbol, value: boolean) => WeakMap +>wm : WeakMap +>set : (key: symbol, value: boolean) => WeakMap +>s : symbol +>true : true + +wm.has(s); +>wm.has(s) : boolean +>wm.has : (key: symbol) => boolean +>wm : WeakMap +>has : (key: symbol) => boolean +>s : symbol + +wm.get(s); +>wm.get(s) : boolean | undefined +>wm.get : (key: symbol) => boolean | undefined +>wm : WeakMap +>get : (key: symbol) => boolean | undefined +>s : symbol + +wm.delete(s); +>wm.delete(s) : boolean +>wm.delete : (key: symbol) => boolean +>wm : WeakMap +>delete : (key: symbol) => boolean +>s : symbol + +const wr = new WeakRef(s); +>wr : WeakRef +>new WeakRef(s) : WeakRef +>WeakRef : WeakRefConstructor +>s : symbol + +wr.deref(); +>wr.deref() : symbol | undefined +>wr.deref : () => symbol | undefined +>wr : WeakRef +>deref : () => symbol | undefined + +const f = new FinalizationRegistry(() => {}); +>f : FinalizationRegistry +>new FinalizationRegistry(() => {}) : FinalizationRegistry +>FinalizationRegistry : FinalizationRegistryConstructor +>() => {} : () => void + +f.register(s, null); +>f.register(s, null) : void +>f.register : (target: WeakKey, heldValue: unknown, unregisterToken?: WeakKey | undefined) => void +>f : FinalizationRegistry +>register : (target: WeakKey, heldValue: unknown, unregisterToken?: WeakKey | undefined) => void +>s : symbol + +f.unregister(s); +>f.unregister(s) : void +>f.unregister : (unregisterToken: WeakKey) => void +>f : FinalizationRegistry +>unregister : (unregisterToken: WeakKey) => void +>s : symbol + diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js index d663bedfe5846..59c64e4c74698 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: es7,0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js index e00eed68dd73c..c51ff3925997f 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: es7,0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js index 4d957e6fbc3e4..b4473aa3f2b95 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: 0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with json api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with json api.js index 4fdc709b776f3..5844a15bc14e9 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with json api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with json api.js @@ -30,5 +30,5 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with jsonSourceFile api.js index a06c8991e2326..6122b24401c05 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs array to compiler-options with jsonSourceFile api.js @@ -30,7 +30,7 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -tsconfig.json:8:4 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +tsconfig.json:8:4 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. 8 ""    ~~ diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with json api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with json api.js index 8343bc138ebaa..f089381ab7632 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with json api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with json api.js @@ -33,5 +33,5 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with jsonSourceFile api.js index dd03e65f3997d..6a996e3a80cea 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert empty string option of libs to compiler-options with jsonSourceFile api.js @@ -33,7 +33,7 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -tsconfig.json:9:4 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +tsconfig.json:9:4 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. 9 ""    ~~ diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with json api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with json api.js index 46cdf454e4caf..0aea5a2fe93a4 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with json api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with json api.js @@ -35,5 +35,5 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with jsonSourceFile api.js index ca0b92c5e4153..bdaa64c07be95 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of libs to compiler-options with jsonSourceFile api.js @@ -35,7 +35,7 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -tsconfig.json:10:4 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +tsconfig.json:10:4 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. 10 "incorrectLib"    ~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with json api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with json api.js index 33f0e5923ebe4..7722a1dc4d9c0 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with json api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with json api.js @@ -30,5 +30,5 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with jsonSourceFile api.js index d1e5b64f9b736..10f48ec0d2d3a 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert trailing-whitespace string option of libs to compiler-options with jsonSourceFile api.js @@ -30,7 +30,7 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -tsconfig.json:8:4 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. +tsconfig.json:8:4 - error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. 8 " "    ~~~~~ diff --git a/tests/baselines/reference/dissallowSymbolAsWeakType.errors.txt b/tests/baselines/reference/dissallowSymbolAsWeakType.errors.txt new file mode 100644 index 0000000000000..6cfa7e561749a --- /dev/null +++ b/tests/baselines/reference/dissallowSymbolAsWeakType.errors.txt @@ -0,0 +1,99 @@ +dissallowSymbolAsWeakType.ts(3,12): error TS2769: No overload matches this call. + Overload 1 of 2, '(iterable: Iterable): WeakSet', gave the following error. + Argument of type 'symbol[]' is not assignable to parameter of type 'Iterable'. + The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'symbol' is not assignable to type 'object'. + Overload 2 of 2, '(values?: readonly object[]): WeakSet', gave the following error. + Type 'symbol' is not assignable to type 'object'. +dissallowSymbolAsWeakType.ts(4,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. +dissallowSymbolAsWeakType.ts(5,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. +dissallowSymbolAsWeakType.ts(6,11): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. +dissallowSymbolAsWeakType.ts(8,12): error TS2769: No overload matches this call. + Overload 1 of 2, '(iterable: Iterable): WeakMap', gave the following error. + Argument of type '[symbol, false][]' is not assignable to parameter of type 'Iterable'. + The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. + Type 'IteratorResult<[symbol, false], any>' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult<[symbol, false]>' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult<[symbol, false]>' is not assignable to type 'IteratorYieldResult'. + Type '[symbol, false]' is not assignable to type 'readonly [object, boolean]'. + Type at position 0 in source is not compatible with type at position 0 in target. + Type 'symbol' is not assignable to type 'object'. + Overload 2 of 2, '(entries?: readonly [object, boolean][]): WeakMap', gave the following error. + Type 'symbol' is not assignable to type 'object'. +dissallowSymbolAsWeakType.ts(9,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. +dissallowSymbolAsWeakType.ts(10,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. +dissallowSymbolAsWeakType.ts(11,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. +dissallowSymbolAsWeakType.ts(12,11): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. +dissallowSymbolAsWeakType.ts(14,24): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. +dissallowSymbolAsWeakType.ts(18,12): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. +dissallowSymbolAsWeakType.ts(19,14): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + + +==== dissallowSymbolAsWeakType.ts (12 errors) ==== + const s: symbol = Symbol('s'); + + const ws = new WeakSet([s]); + ~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(iterable: Iterable): WeakSet', gave the following error. +!!! error TS2769: Argument of type 'symbol[]' is not assignable to parameter of type 'Iterable'. +!!! error TS2769: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. +!!! error TS2769: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2769: Type 'symbol' is not assignable to type 'object'. +!!! error TS2769: Overload 2 of 2, '(values?: readonly object[]): WeakSet', gave the following error. +!!! error TS2769: Type 'symbol' is not assignable to type 'object'. + ws.add(s); + ~ +!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + ws.has(s); + ~ +!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + ws.delete(s); + ~ +!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + + const wm = new WeakMap([[s, false]]); + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(iterable: Iterable): WeakMap', gave the following error. +!!! error TS2769: Argument of type '[symbol, false][]' is not assignable to parameter of type 'Iterable'. +!!! error TS2769: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. +!!! error TS2769: Type 'IteratorResult<[symbol, false], any>' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult<[symbol, false]>' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult<[symbol, false]>' is not assignable to type 'IteratorYieldResult'. +!!! error TS2769: Type '[symbol, false]' is not assignable to type 'readonly [object, boolean]'. +!!! error TS2769: Type at position 0 in source is not compatible with type at position 0 in target. +!!! error TS2769: Type 'symbol' is not assignable to type 'object'. +!!! error TS2769: Overload 2 of 2, '(entries?: readonly [object, boolean][]): WeakMap', gave the following error. +!!! error TS2769: Type 'symbol' is not assignable to type 'object'. + wm.set(s, true); + ~ +!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + wm.has(s); + ~ +!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + wm.get(s); + ~ +!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + wm.delete(s); + ~ +!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + + const wr = new WeakRef(s); + ~ +!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + wr.deref(); + + const f = new FinalizationRegistry(() => {}); + f.register(s, null); + ~ +!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + f.unregister(s); + ~ +!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'. + \ No newline at end of file diff --git a/tests/baselines/reference/dissallowSymbolAsWeakType.js b/tests/baselines/reference/dissallowSymbolAsWeakType.js new file mode 100644 index 0000000000000..58d97a184f5c8 --- /dev/null +++ b/tests/baselines/reference/dissallowSymbolAsWeakType.js @@ -0,0 +1,40 @@ +//// [tests/cases/compiler/dissallowSymbolAsWeakType.ts] //// + +//// [dissallowSymbolAsWeakType.ts] +const s: symbol = Symbol('s'); + +const ws = new WeakSet([s]); +ws.add(s); +ws.has(s); +ws.delete(s); + +const wm = new WeakMap([[s, false]]); +wm.set(s, true); +wm.has(s); +wm.get(s); +wm.delete(s); + +const wr = new WeakRef(s); +wr.deref(); + +const f = new FinalizationRegistry(() => {}); +f.register(s, null); +f.unregister(s); + + +//// [dissallowSymbolAsWeakType.js] +const s = Symbol('s'); +const ws = new WeakSet([s]); +ws.add(s); +ws.has(s); +ws.delete(s); +const wm = new WeakMap([[s, false]]); +wm.set(s, true); +wm.has(s); +wm.get(s); +wm.delete(s); +const wr = new WeakRef(s); +wr.deref(); +const f = new FinalizationRegistry(() => { }); +f.register(s, null); +f.unregister(s); diff --git a/tests/baselines/reference/dissallowSymbolAsWeakType.symbols b/tests/baselines/reference/dissallowSymbolAsWeakType.symbols new file mode 100644 index 0000000000000..ad82de2eafb8d --- /dev/null +++ b/tests/baselines/reference/dissallowSymbolAsWeakType.symbols @@ -0,0 +1,85 @@ +//// [tests/cases/compiler/dissallowSymbolAsWeakType.ts] //// + +=== dissallowSymbolAsWeakType.ts === +const s: symbol = Symbol('s'); +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) +>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, --, --)) + +const ws = new WeakSet([s]); +>ws : Symbol(ws, Decl(dissallowSymbolAsWeakType.ts, 2, 5)) +>WeakSet : Symbol(WeakSet, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +ws.add(s); +>ws.add : Symbol(WeakSet.add, Decl(lib.es2015.collection.d.ts, --, --)) +>ws : Symbol(ws, Decl(dissallowSymbolAsWeakType.ts, 2, 5)) +>add : Symbol(WeakSet.add, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +ws.has(s); +>ws.has : Symbol(WeakSet.has, Decl(lib.es2015.collection.d.ts, --, --)) +>ws : Symbol(ws, Decl(dissallowSymbolAsWeakType.ts, 2, 5)) +>has : Symbol(WeakSet.has, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +ws.delete(s); +>ws.delete : Symbol(WeakSet.delete, Decl(lib.es2015.collection.d.ts, --, --)) +>ws : Symbol(ws, Decl(dissallowSymbolAsWeakType.ts, 2, 5)) +>delete : Symbol(WeakSet.delete, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +const wm = new WeakMap([[s, false]]); +>wm : Symbol(wm, Decl(dissallowSymbolAsWeakType.ts, 7, 5)) +>WeakMap : Symbol(WeakMap, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +wm.set(s, true); +>wm.set : Symbol(WeakMap.set, Decl(lib.es2015.collection.d.ts, --, --)) +>wm : Symbol(wm, Decl(dissallowSymbolAsWeakType.ts, 7, 5)) +>set : Symbol(WeakMap.set, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +wm.has(s); +>wm.has : Symbol(WeakMap.has, Decl(lib.es2015.collection.d.ts, --, --)) +>wm : Symbol(wm, Decl(dissallowSymbolAsWeakType.ts, 7, 5)) +>has : Symbol(WeakMap.has, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +wm.get(s); +>wm.get : Symbol(WeakMap.get, Decl(lib.es2015.collection.d.ts, --, --)) +>wm : Symbol(wm, Decl(dissallowSymbolAsWeakType.ts, 7, 5)) +>get : Symbol(WeakMap.get, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +wm.delete(s); +>wm.delete : Symbol(WeakMap.delete, Decl(lib.es2015.collection.d.ts, --, --)) +>wm : Symbol(wm, Decl(dissallowSymbolAsWeakType.ts, 7, 5)) +>delete : Symbol(WeakMap.delete, Decl(lib.es2015.collection.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +const wr = new WeakRef(s); +>wr : Symbol(wr, Decl(dissallowSymbolAsWeakType.ts, 13, 5)) +>WeakRef : Symbol(WeakRef, Decl(lib.es2021.weakref.d.ts, --, --), Decl(lib.es2021.weakref.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +wr.deref(); +>wr.deref : Symbol(WeakRef.deref, Decl(lib.es2021.weakref.d.ts, --, --)) +>wr : Symbol(wr, Decl(dissallowSymbolAsWeakType.ts, 13, 5)) +>deref : Symbol(WeakRef.deref, Decl(lib.es2021.weakref.d.ts, --, --)) + +const f = new FinalizationRegistry(() => {}); +>f : Symbol(f, Decl(dissallowSymbolAsWeakType.ts, 16, 5)) +>FinalizationRegistry : Symbol(FinalizationRegistry, Decl(lib.es2021.weakref.d.ts, --, --), Decl(lib.es2021.weakref.d.ts, --, --)) + +f.register(s, null); +>f.register : Symbol(FinalizationRegistry.register, Decl(lib.es2021.weakref.d.ts, --, --)) +>f : Symbol(f, Decl(dissallowSymbolAsWeakType.ts, 16, 5)) +>register : Symbol(FinalizationRegistry.register, Decl(lib.es2021.weakref.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + +f.unregister(s); +>f.unregister : Symbol(FinalizationRegistry.unregister, Decl(lib.es2021.weakref.d.ts, --, --)) +>f : Symbol(f, Decl(dissallowSymbolAsWeakType.ts, 16, 5)) +>unregister : Symbol(FinalizationRegistry.unregister, Decl(lib.es2021.weakref.d.ts, --, --)) +>s : Symbol(s, Decl(dissallowSymbolAsWeakType.ts, 0, 5)) + diff --git a/tests/baselines/reference/dissallowSymbolAsWeakType.types b/tests/baselines/reference/dissallowSymbolAsWeakType.types new file mode 100644 index 0000000000000..e246a537b2d61 --- /dev/null +++ b/tests/baselines/reference/dissallowSymbolAsWeakType.types @@ -0,0 +1,107 @@ +//// [tests/cases/compiler/dissallowSymbolAsWeakType.ts] //// + +=== dissallowSymbolAsWeakType.ts === +const s: symbol = Symbol('s'); +>s : symbol +>Symbol('s') : unique symbol +>Symbol : SymbolConstructor +>'s' : "s" + +const ws = new WeakSet([s]); +>ws : WeakSet +>new WeakSet([s]) : WeakSet +>WeakSet : WeakSetConstructor +>[s] : symbol[] +>s : symbol + +ws.add(s); +>ws.add(s) : WeakSet +>ws.add : (value: object) => WeakSet +>ws : WeakSet +>add : (value: object) => WeakSet +>s : symbol + +ws.has(s); +>ws.has(s) : boolean +>ws.has : (value: object) => boolean +>ws : WeakSet +>has : (value: object) => boolean +>s : symbol + +ws.delete(s); +>ws.delete(s) : boolean +>ws.delete : (value: object) => boolean +>ws : WeakSet +>delete : (value: object) => boolean +>s : symbol + +const wm = new WeakMap([[s, false]]); +>wm : WeakMap +>new WeakMap([[s, false]]) : WeakMap +>WeakMap : WeakMapConstructor +>[[s, false]] : [symbol, false][] +>[s, false] : [symbol, false] +>s : symbol +>false : false + +wm.set(s, true); +>wm.set(s, true) : WeakMap +>wm.set : (key: object, value: boolean) => WeakMap +>wm : WeakMap +>set : (key: object, value: boolean) => WeakMap +>s : symbol +>true : true + +wm.has(s); +>wm.has(s) : boolean +>wm.has : (key: object) => boolean +>wm : WeakMap +>has : (key: object) => boolean +>s : symbol + +wm.get(s); +>wm.get(s) : boolean +>wm.get : (key: object) => boolean +>wm : WeakMap +>get : (key: object) => boolean +>s : symbol + +wm.delete(s); +>wm.delete(s) : boolean +>wm.delete : (key: object) => boolean +>wm : WeakMap +>delete : (key: object) => boolean +>s : symbol + +const wr = new WeakRef(s); +>wr : WeakRef +>new WeakRef(s) : WeakRef +>WeakRef : WeakRefConstructor +>s : symbol + +wr.deref(); +>wr.deref() : object +>wr.deref : () => object +>wr : WeakRef +>deref : () => object + +const f = new FinalizationRegistry(() => {}); +>f : FinalizationRegistry +>new FinalizationRegistry(() => {}) : FinalizationRegistry +>FinalizationRegistry : FinalizationRegistryConstructor +>() => {} : () => void + +f.register(s, null); +>f.register(s, null) : void +>f.register : (target: object, heldValue: unknown, unregisterToken?: object) => void +>f : FinalizationRegistry +>register : (target: object, heldValue: unknown, unregisterToken?: object) => void +>s : symbol + +f.unregister(s); +>f.unregister(s) : void +>f.unregister : (unregisterToken: object) => void +>f : FinalizationRegistry +>unregister : (unregisterToken: object) => void +>s : symbol + diff --git a/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.types b/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.types index 9ae226cc85d42..e1c63b94db34a 100644 --- a/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.types +++ b/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.types @@ -129,10 +129,10 @@ export class IterableWeakMap implements WeakMap { this.#finalizationGroup.register(key, { >this.#finalizationGroup.register(key, { set: this.#refSet, ref, }, ref) : void ->this.#finalizationGroup.register : (target: object, heldValue: { readonly ref: WeakRef; readonly set: Set>; }, unregisterToken?: object | undefined) => void +>this.#finalizationGroup.register : (target: WeakKey, heldValue: { readonly ref: WeakRef; readonly set: Set>; }, unregisterToken?: WeakKey | undefined) => void >this.#finalizationGroup : FinalizationRegistry<{ readonly ref: WeakRef; readonly set: Set>; }> >this : this ->register : (target: object, heldValue: { readonly ref: WeakRef; readonly set: Set>; }, unregisterToken?: object | undefined) => void +>register : (target: WeakKey, heldValue: { readonly ref: WeakRef; readonly set: Set>; }, unregisterToken?: WeakKey | undefined) => void >key : K >{ set: this.#refSet, ref, } : { set: Set>; ref: WeakRef; } @@ -223,10 +223,10 @@ export class IterableWeakMap implements WeakMap { this.#finalizationGroup.unregister(ref); >this.#finalizationGroup.unregister(ref) : void ->this.#finalizationGroup.unregister : (unregisterToken: object) => void +>this.#finalizationGroup.unregister : (unregisterToken: WeakKey) => void >this.#finalizationGroup : FinalizationRegistry<{ readonly ref: WeakRef; readonly set: Set>; }> >this : this ->unregister : (unregisterToken: object) => void +>unregister : (unregisterToken: WeakKey) => void >ref : WeakRef return true; diff --git a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js index 99eef771b6bdb..2fb4a9cc6cb09 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js @@ -111,7 +111,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, es2023, 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.date, 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, es2019.intl, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, esnext.intl, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, 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.date, 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, es2019.intl, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection/esnext.collection, esnext.intl, decorators, decorators.legacy default: undefined --allowJs diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index e701f465cbb7d..0c77e3ad9331a 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -111,7 +111,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, es2023, 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.date, 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, es2019.intl, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, esnext.intl, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, 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.date, 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, es2019.intl, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection/esnext.collection, esnext.intl, decorators, decorators.legacy default: undefined --allowJs diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index e701f465cbb7d..0c77e3ad9331a 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -111,7 +111,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, es2023, 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.date, 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, es2019.intl, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, esnext.intl, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, 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.date, 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, es2019.intl, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection/esnext.collection, esnext.intl, decorators, decorators.legacy default: undefined --allowJs diff --git a/tests/baselines/reference/tsserver/telemetry/does-not-expose-paths.js b/tests/baselines/reference/tsserver/telemetry/does-not-expose-paths.js index 1eee3ad3aa407..31410efa3eff0 100644 --- a/tests/baselines/reference/tsserver/telemetry/does-not-expose-paths.js +++ b/tests/baselines/reference/tsserver/telemetry/does-not-expose-paths.js @@ -430,7 +430,7 @@ Info seq [hh:mm:ss:mss] event: "line": 1, "offset": 431 }, - "text": "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'.", + "text": "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'esnext.array', 'esnext.collection', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'.", "code": 6046, "category": "error", "fileName": "/tsconfig.json" diff --git a/tests/baselines/reference/typesVersions.ambientModules.trace.json b/tests/baselines/reference/typesVersions.ambientModules.trace.json index 795eba19aa598..0a410f50e0b3e 100644 --- a/tests/baselines/reference/typesVersions.ambientModules.trace.json +++ b/tests/baselines/reference/typesVersions.ambientModules.trace.json @@ -762,6 +762,18 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2023/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/collection' from '/.src/__lib_node_modules_lookup_lib.es2023.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2023/collection' was not resolved. ========", "======== Resolving module '@typescript/lib-esnext/intl' from '/.src/__lib_node_modules_lookup_lib.esnext.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-esnext/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", diff --git a/tests/baselines/reference/typesVersions.emptyTypes.trace.json b/tests/baselines/reference/typesVersions.emptyTypes.trace.json index 486c6ed7703a3..8d0744b55cfa9 100644 --- a/tests/baselines/reference/typesVersions.emptyTypes.trace.json +++ b/tests/baselines/reference/typesVersions.emptyTypes.trace.json @@ -788,6 +788,19 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2023/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/collection' from '/.src/__lib_node_modules_lookup_lib.es2023.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2023/collection' was not resolved. ========", "======== Resolving module '@typescript/lib-esnext/intl' from '/.src/__lib_node_modules_lookup_lib.esnext.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-esnext/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", diff --git a/tests/baselines/reference/typesVersions.justIndex.trace.json b/tests/baselines/reference/typesVersions.justIndex.trace.json index 30d9b8a6f278b..3ae541cf1d29a 100644 --- a/tests/baselines/reference/typesVersions.justIndex.trace.json +++ b/tests/baselines/reference/typesVersions.justIndex.trace.json @@ -788,6 +788,19 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2023/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/collection' from '/.src/__lib_node_modules_lookup_lib.es2023.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2023/collection' was not resolved. ========", "======== Resolving module '@typescript/lib-esnext/intl' from '/.src/__lib_node_modules_lookup_lib.esnext.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-esnext/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", diff --git a/tests/baselines/reference/typesVersions.multiFile.trace.json b/tests/baselines/reference/typesVersions.multiFile.trace.json index dbccf98b8e862..defb376cbe4e7 100644 --- a/tests/baselines/reference/typesVersions.multiFile.trace.json +++ b/tests/baselines/reference/typesVersions.multiFile.trace.json @@ -741,6 +741,18 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2023/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/collection' from '/.src/__lib_node_modules_lookup_lib.es2023.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2023/collection' was not resolved. ========", "======== Resolving module '@typescript/lib-esnext/intl' from '/.src/__lib_node_modules_lookup_lib.esnext.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-esnext/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json index 795eba19aa598..0a410f50e0b3e 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json @@ -762,6 +762,18 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2023/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/collection' from '/.src/__lib_node_modules_lookup_lib.es2023.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2023/collection' was not resolved. ========", "======== Resolving module '@typescript/lib-esnext/intl' from '/.src/__lib_node_modules_lookup_lib.esnext.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-esnext/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json index dbccf98b8e862..defb376cbe4e7 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json @@ -741,6 +741,18 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2023/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/collection' from '/.src/__lib_node_modules_lookup_lib.es2023.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2023/collection' was not resolved. ========", "======== Resolving module '@typescript/lib-esnext/intl' from '/.src/__lib_node_modules_lookup_lib.esnext.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-esnext/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json index f1bf5278ff8f5..14703ef05c6b3 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json @@ -764,6 +764,18 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2023/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/collection' from '/.src/__lib_node_modules_lookup_lib.es2023.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2023/collection' was not resolved. ========", "======== Resolving module '@typescript/lib-esnext/intl' from '/.src/__lib_node_modules_lookup_lib.esnext.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-esnext/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json index 0889afe41993b..009cab1a57a7e 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json @@ -747,6 +747,18 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2023/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/collection' from '/.src/__lib_node_modules_lookup_lib.es2023.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Loading module '@typescript/lib-es2023/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2023/collection' was not resolved. ========", "======== Resolving module '@typescript/lib-esnext/intl' from '/.src/__lib_node_modules_lookup_lib.esnext.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-esnext/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", diff --git a/tests/cases/compiler/acceptSymbolAsWeakType.ts b/tests/cases/compiler/acceptSymbolAsWeakType.ts new file mode 100644 index 0000000000000..59dbdb4cd83e0 --- /dev/null +++ b/tests/cases/compiler/acceptSymbolAsWeakType.ts @@ -0,0 +1,23 @@ +// @strict: true +// @lib: esnext +// @target: esnext + +const s: symbol = Symbol('s'); + +const ws = new WeakSet([s]); +ws.add(s); +ws.has(s); +ws.delete(s); + +const wm = new WeakMap([[s, false]]); +wm.set(s, true); +wm.has(s); +wm.get(s); +wm.delete(s); + +const wr = new WeakRef(s); +wr.deref(); + +const f = new FinalizationRegistry(() => {}); +f.register(s, null); +f.unregister(s); \ No newline at end of file diff --git a/tests/cases/compiler/dissallowSymbolAsWeakType.ts b/tests/cases/compiler/dissallowSymbolAsWeakType.ts new file mode 100644 index 0000000000000..e6f43b495aead --- /dev/null +++ b/tests/cases/compiler/dissallowSymbolAsWeakType.ts @@ -0,0 +1,22 @@ +// @lib: es2022 +// @target: es2022 + +const s: symbol = Symbol('s'); + +const ws = new WeakSet([s]); +ws.add(s); +ws.has(s); +ws.delete(s); + +const wm = new WeakMap([[s, false]]); +wm.set(s, true); +wm.has(s); +wm.get(s); +wm.delete(s); + +const wr = new WeakRef(s); +wr.deref(); + +const f = new FinalizationRegistry(() => {}); +f.register(s, null); +f.unregister(s);