Skip to content

Add ES2022 Intl.Segmenter type #48800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

petamoriken
Copy link
Contributor

Fixes #48523

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Apr 21, 2022
@petamoriken petamoriken changed the title Feature/intl.segmenter Add ES2022 Intl.Segmenter type Apr 21, 2022
@sandersn sandersn requested review from sandersn and jakebailey May 4, 2022 15:26
@sandersn sandersn self-assigned this May 4, 2022
Copy link
Member

@jakebailey jakebailey left a comment

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.

@DanielRosenwasser DanielRosenwasser merged commit 4a0b083 into microsoft:main May 6, 2022
@petamoriken petamoriken deleted the feature/intl.segmenter branch May 6, 2022 03:28
@leoriviera
Copy link

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
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
Copy link

leoriviera commented May 17, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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