TypeScript/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.types
Orta Therox 07fd7bce64
Intl 2021 Updates (#45647)
* Import of Intl.Locale from #39664

* Handle updating es2020.intl and add es2021 for new DateTimeFormatOptions options - re: #39664

* Extends DateTimeFormatOptions for new Intl APIs - re: #45420

* Handle migrating Intl.NumberFormat.formatToParts to es2018 (keeping esnext.intl around)

* Adds Intl.DisplayNames to es2020 - re: #44022

* Remove attributes added in es2021 from es2020 - re: #42944

* Add a reference to es2021 in the command line parser

* Adds some docs about the lib files

* Baselines

* Allow undefined in Intl inputs to allow for ergonomic usage of exactOptionalPropertyTypes - see #45652

* Adds some tests covering the APIs

* Apply suggestions from code review

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Handle PR feedback

* More review improvements

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-09-08 10:43:01 +01:00

270 lines
8.5 KiB
Plaintext

=== tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts ===
// es2016
const testIncludes = ["hello"].includes("world");
>testIncludes : any
>["hello"].includes("world") : any
>["hello"].includes : any
>["hello"] : string[]
>"hello" : "hello"
>includes : any
>"world" : "world"
// es2017
const testStringPadStart = "".padStart(2);
>testStringPadStart : any
>"".padStart(2) : any
>"".padStart : any
>"" : ""
>padStart : any
>2 : 2
const testStringPadEnd = "".padEnd(2);
>testStringPadEnd : any
>"".padEnd(2) : any
>"".padEnd : any
>"" : ""
>padEnd : any
>2 : 2
const testObjectConstructorValues = Object.values({});
>testObjectConstructorValues : any
>Object.values({}) : any
>Object.values : any
>Object : ObjectConstructor
>values : any
>{} : {}
const testObjectConstructorEntries = Object.entries({});
>testObjectConstructorEntries : any
>Object.entries({}) : any
>Object.entries : any
>Object : ObjectConstructor
>entries : any
>{} : {}
const testObjectConstructorGetOwnPropertyDescriptors = Object.getOwnPropertyDescriptors({});
>testObjectConstructorGetOwnPropertyDescriptors : any
>Object.getOwnPropertyDescriptors({}) : any
>Object.getOwnPropertyDescriptors : any
>Object : ObjectConstructor
>getOwnPropertyDescriptors : any
>{} : {}
const testIntlFormatToParts = new Intl.DateTimeFormat("en-US").formatToParts();
>testIntlFormatToParts : any
>new Intl.DateTimeFormat("en-US").formatToParts() : any
>new Intl.DateTimeFormat("en-US").formatToParts : any
>new Intl.DateTimeFormat("en-US") : Intl.DateTimeFormat
>Intl.DateTimeFormat : { (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; new (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; supportedLocalesOf(locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; }
>Intl : typeof Intl
>DateTimeFormat : { (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; new (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; supportedLocalesOf(locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; }
>"en-US" : "en-US"
>formatToParts : any
const testAtomics = Atomics.add(new Uint8Array(0), 0, 0);
>testAtomics : any
>Atomics.add(new Uint8Array(0), 0, 0) : any
>Atomics.add : any
>Atomics : any
>add : any
>new Uint8Array(0) : Uint8Array
>Uint8Array : Uint8ArrayConstructor
>0 : 0
>0 : 0
>0 : 0
const testSharedArrayBuffer = new SharedArrayBuffer(5);
>testSharedArrayBuffer : any
>new SharedArrayBuffer(5) : any
>SharedArrayBuffer : any
>5 : 5
// es2018
const testPromiseFinally = new Promise(() => {}).finally();
>testPromiseFinally : any
>new Promise(() => {}).finally() : any
>new Promise(() => {}).finally : any
>new Promise(() => {}) : Promise<unknown>
>Promise : PromiseConstructor
>() => {} : () => void
>finally : any
const testRegExpMatchArrayGroups = "2019-04-30".match(/(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/g).groups;
>testRegExpMatchArrayGroups : any
>"2019-04-30".match(/(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/g).groups : any
>"2019-04-30".match(/(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/g) : RegExpMatchArray
>"2019-04-30".match : { (regexp: string | RegExp): RegExpMatchArray; (matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; }
>"2019-04-30" : "2019-04-30"
>match : { (regexp: string | RegExp): RegExpMatchArray; (matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; }
>/(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/g : RegExp
>groups : any
const testRegExpExecArrayGroups = /(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/g.exec("2019-04-30").groups;
>testRegExpExecArrayGroups : any
>/(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/g.exec("2019-04-30").groups : any
>/(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/g.exec("2019-04-30") : RegExpExecArray
>/(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/g.exec : (string: string) => RegExpExecArray
>/(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/g : RegExp
>exec : (string: string) => RegExpExecArray
>"2019-04-30" : "2019-04-30"
>groups : any
const testRegExpDotAll = /foo/g.dotAll;
>testRegExpDotAll : any
>/foo/g.dotAll : any
>/foo/g : RegExp
>dotAll : any
const testIntlPluralRules = new Intl.PluralRules("ar-EG").select(0);
>testIntlPluralRules : any
>new Intl.PluralRules("ar-EG").select(0) : any
>new Intl.PluralRules("ar-EG").select : any
>new Intl.PluralRules("ar-EG") : any
>Intl.PluralRules : any
>Intl : typeof Intl
>PluralRules : any
>"ar-EG" : "ar-EG"
>select : any
>0 : 0
const testAsyncGenerator: AsyncGenerator<any> = null as any;
>testAsyncGenerator : any
>null as any : any
>null : null
const testAsyncGeneratorFunction: AsyncGeneratorFunction = null as any;
>testAsyncGeneratorFunction : any
>null as any : any
>null : null
const testAsyncIterable: AsyncIterable<any> = null as any;
>testAsyncIterable : any
>null as any : any
>null : null
const testAsyncIterableIterator: AsyncIterableIterator<any> = null as any;
>testAsyncIterableIterator : any
>null as any : any
>null : null
const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts();
>testNumberFormatFormatToParts : any
>new Intl.NumberFormat("en-US").formatToParts() : any
>new Intl.NumberFormat("en-US").formatToParts : any
>new Intl.NumberFormat("en-US") : Intl.NumberFormat
>Intl.NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; }
>Intl : typeof Intl
>NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; }
>"en-US" : "en-US"
>formatToParts : any
// es2019
const testArrayFlat = [].flat();
>testArrayFlat : any
>[].flat() : any
>[].flat : any
>[] : undefined[]
>flat : any
const testArrayFlatMap = [].flatMap();
>testArrayFlatMap : any
>[].flatMap() : any
>[].flatMap : any
>[] : undefined[]
>flatMap : any
const testObjectConstructorFromEntries = Object.fromEntries({});
>testObjectConstructorFromEntries : any
>Object.fromEntries({}) : any
>Object.fromEntries : any
>Object : ObjectConstructor
>fromEntries : any
>{} : {}
const testStringTrimStart = "".trimStart();
>testStringTrimStart : any
>"".trimStart() : any
>"".trimStart : any
>"" : ""
>trimStart : any
const testStringTrimEnd = "".trimEnd();
>testStringTrimEnd : any
>"".trimEnd() : any
>"".trimEnd : any
>"" : ""
>trimEnd : any
const testStringTrimLeft = "".trimLeft();
>testStringTrimLeft : any
>"".trimLeft() : any
>"".trimLeft : any
>"" : ""
>trimLeft : any
const testStringTrimRight = "".trimRight();
>testStringTrimRight : any
>"".trimRight() : any
>"".trimRight : any
>"" : ""
>trimRight : any
const testSymbolDescription = Symbol("foo").description;
>testSymbolDescription : any
>Symbol("foo").description : any
>Symbol("foo") : symbol
>Symbol : SymbolConstructor
>"foo" : "foo"
>description : any
// es2020
const testPromiseAllSettled = Promise.allSettled([]);
>testPromiseAllSettled : any
>Promise.allSettled([]) : any
>Promise.allSettled : any
>Promise : PromiseConstructor
>allSettled : any
>[] : undefined[]
const testStringMatchAll = "".matchAll();
>testStringMatchAll : any
>"".matchAll() : any
>"".matchAll : any
>"" : ""
>matchAll : any
const testRegExpMatchAll = /matchAll/g[Symbol.matchAll]("matchAll");
>testRegExpMatchAll : any
>/matchAll/g[Symbol.matchAll]("matchAll") : any
>/matchAll/g[Symbol.matchAll] : any
>/matchAll/g : RegExp
>Symbol.matchAll : any
>Symbol : SymbolConstructor
>matchAll : any
>"matchAll" : "matchAll"
const testBigInt = BigInt(123);
>testBigInt : any
>BigInt(123) : any
>BigInt : any
>123 : 123
// es2021
const testPromiseAny = Promise.any([]);
>testPromiseAny : any
>Promise.any([]) : any
>Promise.any : any
>Promise : PromiseConstructor
>any : any
>[] : undefined[]
const testStringReplaceAll = "".replaceAll();
>testStringReplaceAll : any
>"".replaceAll() : any
>"".replaceAll : any
>"" : ""
>replaceAll : any
// esnext