Repository navigation
Convert src to TypeScript and test the published types - #798
Merged
Merged
Conversation
NullVoxPopuli
force-pushed
the
typescript
branch
from
October 6, 2026 20:50
028803d to
953c27d
Compare
Only `git mv`, no content changes, so the conversion in the next commit shows up as a diff against the original files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Generated declarations were mostly `any` because src was JS. This converts src to TS, adds Glint signatures for the helpers and modifier, registers the keyboard service, and adds `types` conditions to the package exports that were missing them. A new `test-types` workspace package checks the published declarations with expect-type, and a "Type Tests" CI job runs it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
NullVoxPopuli
force-pushed
the
typescript
branch
from
October 6, 2026 21:05
953c27d to
242ecb9
Compare
NullVoxPopuli
commented
Oct 6, 2026
| }, | ||
| "./test-support/key-event": "./dist/test-support/key-event.js", | ||
| "./test-support/test-helpers": "./dist/test-support/test-helpers.js", | ||
| "./test-support/key-event": { |
Contributor
Author
There was a problem hiding this comment.
in another PR, since we're preparing for a major -- we should just have test-support
Contributor
@NullVoxPopuli any insight into why not? |
MelSumner
approved these changes
Oct 9, 2026
Contributor
Author
not at the moment -- will look in to it |
Merged
Contributor
Author
|
turns out to be fixed -- glint just needs updated |
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.
ember-keyboard now publishes real types.
src/is TypeScript, and a newtest-typespackage checks the published declarations withexpect-typein CI.Closes #464. This supersedes #769, which added a hand-written
addon/index.d.tsfor the pre-v2 layout.What consumers get
ember-keyboard:keyResponder,onKey, the listener-name helpers (keyDown,mouseDown, ...), andtriggerKey*.KeyboardResponder,KeyboardHandler,EmberKeyboardEvent,EmberKeyboardConfig, and the Glint signaturesOnKeyModifierSignature,OnKeyHelperSignature,IfKeySignature.helpers/on-key,helpers/if-keyandmodifiers/on-key, so bad args fail in.gtstemplates.KeyboardServiceis in the@ember/serviceregistry, soowner.lookup('service:keyboard')is typed.package.json#exportsnow hastypesfor.and bothtest-support/*entries. Before,import { onKey } from 'ember-keyboard'resolved to no types at all. I also addedtypesVersionsfor consumers still onnode10resolution.Runtime changes
The goal was no behavior change. The tests (206 pass, 2 skipped, same as
master) agree. Small things you might notice in the diff:modifiers/on-key: both class variants are now at module level, andmacroConditionpicks one in a ternary. TypeScript doesn't allow decorators on class expressions.keyRespondersets the classnamewithObject.defineProperty, because TS rejectsstatic name.handle-key-event: removed theif (ekEvent)branch. Both callers always passekEvent, so the branch was never used.srcimports use.tsextensions, and so do the#src/*imports intests/anddemo-app/.Type tests
test-types/is a private workspace package. It depends onember-keyboard: workspace:*and type-checks against the builtdeclarations/, notsrc/. That way it catches broken exports and bad declaration output. It covers the index exports, decorators, the service and registry, test-support, and template invocations of the helpers and modifier (including@glint-expect-errorcases). I checked that the suite fails when an assertion is wrong.CI has a new "Type Tests" job that runs
pnpm build && pnpm --filter test-types test.Not included
on-keyhelper and theon-keymodifier share a name, and a single registry key can't hold both. Strict-mode imports work.{{onKey "a"}}), so there is no test for that case.🤖 Generated with Claude Code