Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript extending ServiceObject doesn't pass T causing service object methods to return untyped. #1206

Closed
kitsunde opened this issue May 19, 2023 · 1 comment · May be fixed by #1263
Closed
Assignees
Labels
api: bigquery Issues related to the googleapis/nodejs-bigquery API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@kitsunde
Copy link

kitsunde commented May 19, 2023

Various places that extend ServiceObject https://github.com/googleapis/nodejs-bigquery/blob/main/src/table.ts#L218 does this:

class Table extends ServiceObject {}

It should be

class Table extends ServiceObject<Table> {}

Because right now dataset.table('foo').get() isn't typed.

Typescript example of the issue: https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgMrQG7CQeQEYBWECYAPACrIC8ycIAngHzIDeAUMp8gOYRgAUASgBcycmwC+AbjZtQkWIhTk4eADYoIAD0ggAJgGc0mbBHxESraXPDR4SZADFgWiHpXrNOiPqPooWLiExGTOru6qGsws1mwIAPYgBmDIMPHx1Fa0Rh4aMmnxAHS8YBzIAPTlyAB6APyyCUkpeHBQmTHZTi5uuRAyLVDFfGWVNfVAA

@kitsunde kitsunde added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels May 19, 2023
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/nodejs-bigquery API. label May 19, 2023
@loferris loferris self-assigned this Aug 9, 2023
@loferris loferris added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Aug 24, 2023
@loferris
Copy link
Contributor

Hi @kitsunde, I'm re-labeling this as a feature request. Although I agree we should have stricter typing on .get() methods in this library (and thanks so much for catching that!), introducing the direct fix could possibly create breaking changes, and would have to wait for a major version release. Let us know if you have some specific use-cases you're wanting to cover with the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/nodejs-bigquery API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants