fix: export Key, KeyAction, Mods, DirtyState as runtime values#130
Merged
sreya merged 2 commits intocoder:mainfrom Feb 24, 2026
Merged
fix: export Key, KeyAction, Mods, DirtyState as runtime values#130sreya merged 2 commits intocoder:mainfrom
sreya merged 2 commits intocoder:mainfrom
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-019c8a33-a7d6-72da-baa3-6cc640a1738c Co-authored-by: Amp <amp@ampcode.com>
sreya
approved these changes
Feb 24, 2026
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.
Problem
Fixes #129
lib/index.tsexportsKey,KeyAction, andModsas type-only (line 75), which strips their runtime values from the JS bundle. Consumers who do:get
undefinedat runtime, even though the.d.tsdeclares them as real enums. This makes it impossible to construct aKeyEventforKeyEncoder.encode()without manually duplicating the enum values.Additionally,
DirtyState(defined intypes.ts, re-exported fromghostty.ts) is never included inindex.ts, so it is not part of the public API.CellFlagsandKeyEncoderOptionare already exported correctly as values — these four are the only ones affected.Fix
Key,KeyAction,Modsfromexport type { ... }toexport { ... }so they appear as runtime values in the bundle.DirtyStateto the re-export from./ghostty, alongside the existingCellFlagsandKeyEncoderOption.Verification
tsc --noEmitpassesbiome checkpassesvite buildsucceedsdist/ghostty-web.js.d.tsstill declares all six enums correctlymain(38 pass, 290 fail — the failures are a pre-existinghappy-domWASM fetch issue unrelated to this change)