Closed
Description
Suggestion
π Search Terms
Intl.ListFormat
Intl
ListFormat
β Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
β Suggestion
Add Intl.ListFormat
to es2021 lib types (as per Finished Proposals).
Bringing this API to Typescript has been directly suggested before, but didn't follow the issue templates (#46866), and was also mentioned before (#45646 (comment), #29129 (comment)), but, as I couldn't find any specific active issue where the feature suggestion is being considered, I'm opening this issue.
π Motivating Example
Code that uses the Intl.ListFormat API should not fail type checking:
new Intl.ListFormat('bg', {type: 'conjunction'}).format(['a','b','c'])
new Intl.ListFormat('bg', {type: 'disjunction'}).formatToParts(['a','b','c'])
π» Use Cases
new Intl.ListFormat('bg', {type: 'conjunction'}).format(['a','b','c'])
new Intl.ListFormat('bg', {type: 'disjunction'}).formatToParts(['a','b','c'])