Skip to content

Request to remove wildcard type from Datastore instances #791

Open
@karatekaneen

Description

@karatekaneen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: datastoreIssues related to the googleapis/nodejs-datastore API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions