fix(types): OAuthError.inner, saveToken input, and getClient clientSecret#444
Merged
jankapunkt merged 3 commits intoJun 16, 2026
Merged
Conversation
OAuthError sets `this.inner` to the wrapped error when constructed from another Error (lib/errors/oauth-error.js), but the property was absent from the published typings. Add `inner?: Error` so consumers can read it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The grant types call model.saveToken() with a token object that does not
include `client`/`user` — those are passed as separate arguments and must
be present on the returned value. Typing the input as the full `Token`
allowed `saveToken(token) { return token }` to type-check while throwing at
runtime. Narrow the input to `Omit<Token, 'client' | 'user'>`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The token handler calls model.getClient() with no client secret for public / PKCE clients (clientSecret is `undefined`), and the docs describe it as nullable, but the typing required a `string`. Make it optional (`clientSecret?: string`). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jankapunkt
approved these changes
Jun 16, 2026
Member
|
Due to the recommendation of a minor release I am about to create an RC for this. Any objections @dhensby ? |
Contributor
Author
Maybe wait for a few more PRs to land 😉 |
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.
What
Three
index.d.tstyping corrections.Closes #367. Closes #368.
Changes
fix(types): add missing OAuthError.inner property(#367)OAuthErrorsetsthis.innerto the wrapped error when constructed from anotherError(oauth-error.js), and the handlers do exactly that (new ServerError(e)), but the property was missing from the published typings. Addedinner?: Error. Thanks @papermana for the report.fix(types): correct saveToken input to exclude client/user(#368)The grant types call
model.saveToken()with a token object that does not includeclient/user— they're passed as separate arguments and must be present on the returned value (TokenModelrequires them). Typing the input as the fullTokenletsaveToken(token) { return token }type-check while throwing at runtime. Narrowed the input toOmit<Token, 'client' | 'user'>. Thanks @papermana.fix(types): allow getClient clientSecret to be omittedThe token handler calls
model.getClient()with no client secret for public / PKCE clients (clientSecretisundefined), and the docs describe it as nullable, but the typing required astring. Made it optional (clientSecret?: string). This addresses the secondary typing point raised by @Valerionn in #281's thread.Notes
index.d.tsstill compiles cleanly (tsc --noEmit --strict).saveTokenchange is a type-only tightening: it can surface (correct) compile errors in consumer code that relied on the old, inaccurate type. No runtime change — but you may prefer to release it in a minor rather than a patch.🤖 Generated with Claude Code