microsoft / TypeScript Public
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
fix: update types for RTF.p.formatToParts() result #46508
base: main
Are you sure you want to change the base?
fix: update types for RTF.p.formatToParts() result #46508
Conversation
|
It looks like you've sent a pull request to update our 'lib' files. These files aren't meant to be edited by hand, as they consist of last-known good states of the compiler and are generated from 'src'. Unless this is necessary, consider closing the pull request and sending a separate PR to update 'src'. |
I was a little confused by these dual files because only the |
|
You'll need to make the update in |
@DanielRosenwasser the |
Still hoping to get an answer to this question. |
|
Sorry, if they're not from |
|
I've updated the bot's message for the future, thanks for pointing out that it wasn't clear, and sorry for the confusion! |
@DanielRosenwasser - Sorry I still don't understand what are the right next steps in this PR.
The specific spec link I'm concerned about is https://tc39.es/ecma402/#sec-singularrelativetimeunit which is the most relevant link for the |
|
Okay, I reread the changes - a double apology for the misunderstanding. You'll need to back out |
@DanielRosenwasser - OK that answers question (1) above, but not the other two questions:
|
|
If it's important, would it just make more sense to add content to MDN than to deep link to the spec? I don't think most users are interested in parsing spec text. |
This commit updates the type of `RelativeTimeFormatPart` to clarify that the `unit` prop is always singular, unlike the plural or singular values that are accepted as inputs. This also changes `RelativeTimeFormatPart` to be a discriminated union type because the `unit` prop is only present if the `type` prop's value is not "literal". Fixes microsoft#46245
ef5fc0c
to
150ccd1
I assumed it was mostly needed for the TS team to verify that the types match the spec. Anyway, sounds like it's not needed so I just reverted the changes to |
This PR:
RelativeTimeFormatPartto clarify that theunitprop is always singular in the result's array elements, unlike the plural or singular values that are accepted as inputs. Spec: https://tc39.es/ecma402/#sec-PartitionRelativeTimePattern step 5RelativeTimeFormatPartto be a discriminated union type because theunitprop is only present if thetypeprop's value is not "literal". Spec: https://tc39.es/ecma402/#sec-makepartslist step 3Fixes #46245
@orta - what are the right tests to add for this kind of change?
The text was updated successfully, but these errors were encountered: