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

Request to remove wildcard type from Datastore instances #791

Open
karatekaneen opened this issue Feb 3, 2021 · 0 comments
Open

Request to remove wildcard type from Datastore instances #791

karatekaneen opened this issue Feb 3, 2021 · 0 comments
Labels
api: datastore Issues related to the googleapis/nodejs-datastore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@karatekaneen
Copy link

The issue

The Datastore instance inherits from DatastoreRequest which among other things contain:

[key: string]: Entity; // Entity is aliased to any

This is a problem when dealing with typos since the return types are any all code following still compiles without warning.

Example:

const datastore = new Datastore()

datastore.fooBar('hello') // No warning or anything here

const [data] = await datastore.GET(key) 
// obvious typo here but the `data` variable has type "any" 
// and all following code compiles without warning

model.process(data) // No warning here either

Request

Since my knowledge of how the class works is very limited I'm not sure if it's possible but it would be nice if obvious errors like the one I showed are caught at write-time by having stricter types.

@product-auto-label product-auto-label bot added the api: datastore Issues related to the googleapis/nodejs-datastore API. label Feb 3, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Feb 4, 2021
@bcoe bcoe added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Feb 5, 2021
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/nodejs-datastore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants