Repository navigation
Description
This tracks a fix the fork carries in upstream-owned code, so we can drop it once microsoft/TypeScript-DOM-lib-generator fixes the same problem.
Problem
With @mdn/browser-compat-data 8.1.8, npm run build crashes:
Error: Unknown DOM type: SpeechGrammar
at convertDomTypeToTsTypeSimple (src/build/emitter.ts)
...
at emitMethod (src/build/emitter.ts)
This first broke the 2026-11-07 weekly update.
BCD 8.1.8 records unflagged Firefox 160 support for the Web Speech API:
SpeechGrammarListis unprefixed in Chrome 139+ and Firefox 160+. It meets the two-engine rule and is kept.SpeechGrammar: Chrome only exposes the interface object aswebkitSpeechGrammar, so only one engine has it unprefixed. It's dropped.
SpeechGrammarList.item() still returns SpeechGrammar. The emitter doesn't filter return types that point at removed interfaces, so it throws.
Fork fix (#32)
src/build/bcd/keep-alive.ts: addsSpeechGrammar: []toforceKeepAlive. This is the only upstream-facing change, written the way upstream would likely write it.- Fork-only, stays even after upstream fixes it:
src/build/bcd/baseline.tsaddsfullLibOnlyKeepAlive, whichsrc/build/bcd.tschecks so Baseline cuts ignore the entry. Cuts don't need it, becauseapplyReferenceClosureresurrects referenced interfaces. Forcing it into the cuts would emit an empty, non-BaselineSpeechGrammarwith a constructor in every package.
Upstream status (checked 2026-11-07, upstream main @ 51e2d51)
Not fixed yet. Upstream is still on BCD 8.0.4 and has no SpeechGrammar entry in keep-alive.ts. It should hit the same crash as soon as it updates to BCD ≥ 8.1.8.
Another possible fix: the BCD data may be wrong. If Chrome actually exposes SpeechGrammar unprefixed, a corrected BCD entry would remove the need for any keep-alive. That's unverified, so check it before filing with mdn/browser-compat-data.
How to check
- Does upstream
src/build/bcd/keep-alive.tscontainSpeechGrammar? Or does upstream filter or keep it some other way (for example, a BCD fix, or emitter handling for return types that point at removed interfaces)? - Or: on upstream
mainwith the latest BCD, doesnpm run buildsucceed without our entry?
When upstream fixes it
- Upstream adds the same
forceKeepAliveentry: take upstream's version ofkeep-alive.tswhen merging, so the file matches upstream again. KeepfullLibOnlyKeepAliveinbaseline.ts. - Upstream fixes it another way, or BCD fixes the data: remove our
keep-alive.tsentry and the"SpeechGrammar"item infullLibOnlyKeepAlive. Then rebuild and confirm thatbaselines/and every Baseline cut (npm run baseline-years) don't change unexpectedly.
Close this issue once the fork's keep-alive.ts matches upstream again.
Activity
uhyo commentedon Nov 30, 2026
Upstream status (checked 2026-11-30, upstream
main@ f7effdf)Fixed upstream, in a different way. Upstream updated to BCD 8.1.8 in 988acab (microsoft#2602) and handled
SpeechGrammarwith a new KDL patch rather than aforceKeepAliveentry:Upstream
src/build/bcd/keep-alive.tsstill has noSpeechGrammarentry. Upstream'sbaselines/dom.generated.d.tsnow emitsSpeechGrammarwithdeclare var SpeechGrammar: { new(): SpeechGrammar }.Next steps (from "When upstream fixes it")
Upstream fixed it another way, so on the next upstream merge:
SpeechGrammar: []entry fromkeep-alive.tsand the"SpeechGrammar"item fromfullLibOnlyKeepAliveinbaseline.ts;baselines/and every Baseline cut (npm run baseline-years) don't change unexpectedly.Caveat to check:
speech.kdlis a patch, and patches are also applied to Baseline cuts. It might bring back the empty, non-BaselineSpeechGrammarwith a constructor thatfullLibOnlyKeepAlivewas added to avoid. If the cuts do change that way, the fork may need its own handling for cuts.Generated by Claude Code
uhyo commentedon Dec 1, 2026
Resolved by #40, which merged upstream
main@ f7effdf intobaseline-filterand dropped the fork's version of this fix in favour of upstream's. Closing.Generated by Claude Code