Skip to content

Add ES2022 Intl.Segmenter type - #48800

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 5 commits into
microsoft:mainfrom
petamoriken:feature/intl.segmenter
May 6, 2022
Merged

Daniel Rosenwasser (DanielRosenwasser) merged 5 commits into
microsoft:mainfrom
petamoriken:feature/intl.segmenter

Conversation

@petamoriken

Copy link
Copy Markdown
Contributor

Fixes #48523

@typescript-bot TypeScript Bot (typescript-bot) added the For Backlog Bug PRs that fix a backlog bug label Apr 21, 2022
@petamoriken Kenta Moriuchi (petamoriken) changed the title Feature/intl.segmenter Add ES2022 Intl.Segmenter type Apr 21, 2022

@jakebailey Jake Bailey (jakebailey) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nit, but it looks like every other lib d.ts file is formatted with four spaces, the standard we use in this repo, while the file added here uses two.

Comment thread src/lib/es2022.intl.d.ts Outdated
@leoriviera

Copy link
Copy Markdown

Taking a looking at the MDN article for this, the locale is optional, meaning the first argument may be an object containing options for the segmenter.

@jakebailey

Copy link
Copy Markdown
Member

The syntax section implies that you have to provide locales if you want to supply options. The definition in this PR already makes it optional in that way (pass undefined).

If you pass an options object as the first parameter, the Segmenter you get back doesn't work properly, so I don't think that's correct (even if it doesn't crash). Try deleting 'fr' from the code example on the page and run it, then compare if you pass undefined.

@leoriviera

Leo. (leoriviera) commented May 17, 2022 •

Copy link
Copy Markdown

I did weigh up the syntax section when writing that comment. Thank you for clarifying my understanding of this. I really appreciate it.

@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Missing type of ES2022 Intl.Segmenter

6 participants