Skip to content

Commit b5abcb0

Browse files
ckknightJustinBeckwith
authored andcommitted
fix(types): correct type of Datastore.KEY (#459)
`entity.KEY_SYMBOL` is defined as a `unique symbol` and without explicit reference back to the original type, the `unique symbol` flows into a regular `symbol`, which loses some of its semantic meaning. This guarantees that `Datastore.KEY` and `entity.KEY_SYMBOL` (and `new Datastore().KEY`) are truly equivalent within the type system.
1 parent 6ec33da commit b5abcb0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

handwritten/datastore/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ class Datastore extends DatastoreRequest {
576576
* @name Datastore#KEY
577577
* @type {symbol}
578578
*/
579-
static KEY = entity.KEY_SYMBOL;
580-
KEY = Datastore.KEY;
579+
static KEY: typeof entity.KEY_SYMBOL = entity.KEY_SYMBOL;
580+
KEY: typeof entity.KEY_SYMBOL = Datastore.KEY;
581581

582582
/**
583583
* This is one of three values which may be returned from

0 commit comments

Comments
 (0)