Repository navigation
addons: declare the optional arguments of installGPTEventListeners and tryIdentifyFromParams - #379
Merged
Merged
Conversation
…d tryIdentifyFromParams Both methods accept optional arguments (eventSpec; key and prefix), and the README documents calling them with those arguments, but their module augmentations declared them as () => void. TypeScript consumers copying the documented calls got "Expected 0 arguments". Types only; no runtime change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericst-amand-optable
approved these changes
Oct 30, 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.
Why
installGPTEventListenersandtryIdentifyFromParamsaccept optional arguments, and the README documents calling them with those arguments (README "GPT event listeners" and "Call tryIdentifyFromParams SDK API"). Their module augmentations declared them as() => void, so TypeScript consumers copying the documented calls get a compile error:JavaScript and script-tag users are unaffected (types only). Found while type-checking the product docs' examples against the SDK.
What Changed
lib/addons/gpt.ts:installGPTEventListeners: (eventSpec?: GptEventSpec) => void, matching the implementation's signature.lib/addons/try-identify.ts:tryIdentifyFromParams: (key?: string, prefix?: string) => void, matching the implementation's signature.How to Test
pnpm build-lib,tsc -b browser,pnpm test(36 suites, 680 tests) andpnpm formatall pass locally with no other changes.A TypeScript consumer calling both methods with and without arguments fails on
masterwith the two errors above and compiles cleanly with this change.Tested
Docs updated (not needed: no behavior change; the README already documents these arguments)
Notes
🤖 Generated with Claude Code