This repository was archived by the owner on Nov 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 406
This repository was archived by the owner on Nov 20, 2025. It is now read-only.
feat!: Normalize GoogleAuth<T> to AuthClient #1677
Copy link
Copy link
Closed
Labels
Breaking Changenext major: breaking changethis is a change that we should wait to bundle into the next major versionthis is a change that we should wait to bundle into the next major versionpriority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.semver: majorHint for users that this is an API breaking change.Hint for users that this is an API breaking change.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
We should normalize GoogleAuth<T extends AuthClient = JSONClient> to GoogleAuth<T extends AuthClient = AuthClient> (and GoogleAuthOptions as well).
Additionally, we should:
-
change
clientOptionsfrom:
google-auth-library-nodejs/src/auth/googleauth.ts
Lines 106 to 114 in 4f94ffe
/** * Options object passed to the constructor of the client */ clientOptions?: | JWTOptions | OAuth2ClientOptions | UserRefreshClientOptions | ImpersonatedOptions;
to:/** * Options object passed to the constructor of the client */ clientOptions?: ConstructorParameters<typeof T>[0];
In both
GoogleAuthandGoogleAuthOptionsto accurately match the expected client options. -
change
cachedCredentialfrom:
google-auth-library-nodejs/src/auth/googleauth.ts
Lines 160 to 161 in f950465
cachedCredential: JSONClient | Impersonated | Compute | T | null = null;
to:cachedCredential: T | null = null;
in order to normalize the expected
AuthClient
Dependencies:
- feat: Backwards-Compatible Auth #1624
- feat: Unify Base
AuthClientOptions #1663 - refactor!: @deprecate
additionalOptionsfrom AuthClients #1672
Implementation Notes:
- Look into overload narrowing (which is a pain at the time of writing), which is required for accurate
ConstructorParametersresults:- ConstructorParameters<T> cannot get correct types of overloaded constructor microsoft/TypeScript#37079
- https://stackoverflow.com/questions/59745527/is-it-possible-to-narrow-the-types-of-overloaded-parameters-without-exhaustively
- Note: We may just have to reorganize overloads in each
AuthClientto the desired overload signature as the first overload ('desired' = whichever one exposes the extendedAuthClientOptionsas the first option).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Breaking Changenext major: breaking changethis is a change that we should wait to bundle into the next major versionthis is a change that we should wait to bundle into the next major versionpriority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.semver: majorHint for users that this is an API breaking change.Hint for users that this is an API breaking change.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.