Skip to content

google.webmasters auth typing error with GoogleAuth<JSONClient> after v150.0.1Β #3677

@Towerss

Description

@Towerss

Please make sure you have searched for information in the following guides.

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.

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infoThis issue needs more information from the customer to proceed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions