Repository navigation
Remove non-erasable TypeScript syntax from Polyfill - #653
Merged
Merged
Conversation
Replace internal constant objects with scalar bindings so bundlers can eliminate unused values and avoid materializing lookup maps. Minified ESM Window bundle versus 1aacf66 (esbuild 0.25.12): - minified: 21,518 B -> 20,742 B (-776 B) - gzip: 7,321 B -> 7,167 B (-154 B) - Brotli: 6,564 B -> 6,383 B (-181 B)
andrewiggins
force-pushed
the
fix-erasableSyntaxOnly-exceptions
branch
from
September 1, 2026 14:59
aa5d729 to
67552cc
Compare
olavoasantos
approved these changes
Sep 1, 2026
Merged
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.
Summary
@remote-dom/polyfillwas the last project in this repo that didn't supporterasableSyntaxOnlywithout exceptions. This PR removes those exceptions.It turns out that our babel transform turned these
const enumsinto full TS enums even though we didn't use them as such. These data structures cost us 1.5kb in a minified build. So I've replaced theconst enums with justconstvariables. These enums were never exported publically so it shouldn't be a breaking change. It also more closely matches the DOM which just uses raw numbers here anyway.What changed
const enumdeclarations with erasable scalar constantsnumberand namespace values as a string-literal union@remote-dom/polyfillEvery TypeScript project now enables
erasableSyntaxOnlywithout syntax-related suppression comments.ESM bundle size
Measured by bundling and minifying the public
Windowexport with esbuild 0.25.12:Testing
pnpm exec tsc --build --pretty --forcepnpm exec vitest runpnpm buildpnpm lintpnpm exec playwright test --workers=1