Add lossless option to fmtQuantity#4454
Merged
Merged
Conversation
Compacts to millions / billions units only when doing so loses no precision, rendering the full value (at natural precision) otherwise - e.g. `7,100,100` stays `7,100,100` rather than collapsing to `7.10m`. - Extracts the auto/fixed precision resolution from `buildFormatConfig` into a shared `parsePrecision` helper, reused by the compaction-exactness check. - The compaction decision uses the standard display precision as its threshold; `lossless` independently drives rendering at full precision when not compacting. Closes #4219
…format # Conflicts: # CHANGELOG.md
…format # Conflicts: # CHANGELOG.md
- Escape `>=` in `QuantityFormatOptions` doc comments so TSDoc doesn't read the bare `>` as an HTML tag start. - Drop a redundant inline triple-backtick from a prose JSDoc comment in `ts-registry.ts` that the parser mistook for a code-fence opener (pre-existing, from #4406). Claude-Session: https://claude.ai/code/session_01Ce4kWUGq9joZDQwGSAbvEu
Member
|
Thanks for landing this - Toolbox formatter demo updated @ xh/toolbox@625e727 |
Member
Author
|
Had a pr for this with same name. Will look to see if anything worth
adding
…On Wed, Jun 24, 2026, 7:40 PM Anselm McClain ***@***.***> wrote:
*amcclain* left a comment (xh/hoist-react#4454)
<#4454 (comment)>
Thanks for landing this - Toolbox formatter demo updated @ xh/toolbox@
625e727
<xh/toolbox@625e727>
—
Reply to this email directly, view it on GitHub
<#4454?email_source=notifications&email_token=AARTL2KKATBYQ3GU2IH57SL5BRRGTA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINZZGQ2TGOJQGI3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4794539026>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARTL2IEQ5OH2RMPUWV4JCT5BRRGTAVCNFSNUABFKJSXA33TNF2G64TZHMYTCNZXGMZTKNRXHNEXG43VMU5TINZTGQ3DONZRGY2KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AARTL2PKRRUZ3HADVOHUPPD5BRRGTA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINZZGQ2TGOJQGI3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/AARTL2KWZ46EP4PFHFTWJAD5BRRGTA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINZZGQ2TGOJQGI3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
losslessoption tofmtQuantity(issue #4219). When set, the formatter compacts to millions / billions units only when doing so loses no precision; otherwise it renders the full value at its natural precision.7,100,000→7.10m(exact, compacts)7,100,100→7,100,100(would lose the trailing100, so renders full)123.456withlossless→123.456(no longer rounded to123)Changes
losslessopt onQuantityFormatOptions(default false).buildFormatConfiginto a sharedparsePrecisionhelper, reused by the compaction-exactness check.losslessindependently drives full-precision rendering when not compacting.Closes #4219
Not changing the default tooltip
The issue also floated defaulting
tooltip: truefor non-losslesslossy renders. Skipped: that would silently add hover tooltips to every existingfmtQuantitycall site - a broad, app-wide behavior change disproportionate to an opt-in feature.losslessalready surfaces the lost precision inline, andtooltip: trueremains available per-call.