TypeScript/tests/baselines/reference/es2018IntlAPIs.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

36 lines
2.2 KiB
Plaintext

=== tests/cases/conformance/es2018/es2018IntlAPIs.ts ===
// Sample from
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/supportedLocalesOf
const locales = ['ban', 'id-u-co-pinyin', 'de-ID'];
>locales : string[]
>['ban', 'id-u-co-pinyin', 'de-ID'] : string[]
>'ban' : "ban"
>'id-u-co-pinyin' : "id-u-co-pinyin"
>'de-ID' : "de-ID"
const options = { localeMatcher: 'lookup' } as const;
>options : { readonly localeMatcher: "lookup"; }
>{ localeMatcher: 'lookup' } as const : { readonly localeMatcher: "lookup"; }
>{ localeMatcher: 'lookup' } : { readonly localeMatcher: "lookup"; }
>localeMatcher : "lookup"
>'lookup' : "lookup"
console.log(Intl.PluralRules.supportedLocalesOf(locales, options).join(', '));
>console.log(Intl.PluralRules.supportedLocalesOf(locales, options).join(', ')) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>Intl.PluralRules.supportedLocalesOf(locales, options).join(', ') : string
>Intl.PluralRules.supportedLocalesOf(locales, options).join : (separator?: string) => string
>Intl.PluralRules.supportedLocalesOf(locales, options) : string[]
>Intl.PluralRules.supportedLocalesOf : (locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }) => string[]
>Intl.PluralRules : { (locales?: string | string[], options?: Intl.PluralRulesOptions): Intl.PluralRules; new (locales?: string | string[], options?: Intl.PluralRulesOptions): Intl.PluralRules; supportedLocalesOf(locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; }
>Intl : typeof Intl
>PluralRules : { (locales?: string | string[], options?: Intl.PluralRulesOptions): Intl.PluralRules; new (locales?: string | string[], options?: Intl.PluralRulesOptions): Intl.PluralRules; supportedLocalesOf(locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; }
>supportedLocalesOf : (locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }) => string[]
>locales : string[]
>options : { readonly localeMatcher: "lookup"; }
>join : (separator?: string) => string
>', ' : ", "