We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Search Terms: Intl NumberFormatPartsType Code
const formatter = new Intl.NumberFormat('en', {style: 'unit', unit: 'kilobyte'}); return formatter.formatToParts(0).find(part => part.type === 'unit').value;
Expected behavior: Compiles cleanly. See, for example, this MDN doc for Intl.formatByParts() which lists "unit" as a possible part type
Actual behavior: tsc throws an error: This condition will always return 'false' since the types 'NumberFormatPartTypes' and '"unit"' have no overlap. Playground Link: https://www.typescriptlang.org/play?target=99&ts=4.2.0-dev.20201211#code/KYDwDg9gTgLgBAMwK4DsDGMCWEVwLYCGA1sAKoqYwBi0hMMwUAFKpQFxwDOMUmKA5gBo4AGwICkBfsA7deAgJRwA3gCg4cKMBhIouFMADucAJIoYIgHQA5JHgBGjGlDpMxEqcGHLuATxEycADkrDBBwqEAvgoA3KqRqqqgkLCIqBjYuAi0BPTAACbklCwUMLI8fEKi4vyS0uXy-EpqGmg43Ig5eVBwALz4xGSlznQMzKHC7rWeseqa2rpZXWOW2S65ACoQAAoEsJxMAAwKq3z5TExge-C9AHxwV7CWML5gwH29-SGlQQonAG4EERIYBxSJAA
Related Issues:
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
Search Terms:
Intl
NumberFormatPartsType
Code
Expected behavior:
Compiles cleanly. See, for example, this MDN doc for Intl.formatByParts() which lists "unit" as a possible part type
Actual behavior:
tsc throws an error: This condition will always return 'false' since the types 'NumberFormatPartTypes' and '"unit"' have no overlap.
Playground Link:
https://www.typescriptlang.org/play?target=99&ts=4.2.0-dev.20201211#code/KYDwDg9gTgLgBAMwK4DsDGMCWEVwLYCGA1sAKoqYwBi0hMMwUAFKpQFxwDOMUmKA5gBo4AGwICkBfsA7deAgJRwA3gCg4cKMBhIouFMADucAJIoYIgHQA5JHgBGjGlDpMxEqcGHLuATxEycADkrDBBwqEAvgoA3KqRqqqgkLCIqBjYuAi0BPTAACbklCwUMLI8fEKi4vyS0uXy-EpqGmg43Ig5eVBwALz4xGSlznQMzKHC7rWeseqa2rpZXWOW2S65ACoQAAoEsJxMAAwKq3z5TExge-C9AHxwV7CWML5gwH29-SGlQQonAG4EERIYBxSJAA
Related Issues:
The text was updated successfully, but these errors were encountered: