Description
Please make sure you have searched for information in the following guides.
- Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
- Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
- Check our Troubleshooting guide: https://github.com/googleapis/google-cloud-node/blob/main/docs/troubleshooting.md
- Check our FAQ: https://github.com/googleapis/google-cloud-node/blob/main/docs/faq.md
- Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
- Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
- Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples
A screenshot that you have tested with "Try this API".
Hi maintainers 👋
After upgrading googleapis from version ^149.0.0 to 150.0.1, I ran into a TypeScript type error related to the auth property when initialising the webmasters API.
Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.
https://gist.github.com/Towerss/c4885527a8ddc5e66c4cffa543398d19
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
Run tsc to see the typing error.
A clear and concise description of what the bug is, and what you expected to happen.
After upgrading from googleapis@^149.0.0 to 150.0.1, TypeScript no longer accepts a GoogleAuth instance as a valid auth parameter when initializing the webmasters API client.
This code worked previously:
const auth = new GoogleAuth<JSONClient>({
keyFile: 'path/to/key.json',
scopes: ['https://www.googleapis.com/auth/webmasters'],
});
const searchConsole = google.webmasters({ version: 'v3', auth }); // ✅ worked in v149.x
But now produces a type error in v150.0.1:
Type 'GoogleAuth' is not assignable to type 'GoogleAuth'
Property '#private' in type 'GoogleAuth' refers to a different member that cannot be accessed from within type 'GoogleAuth'
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
googleapis.webmasters should allow passing GoogleAuth as the auth parameter, as it was supported in earlier versions and is the type returned from the current google-auth-library.