File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import arrify = require('arrify');
1818import * as extend from 'extend' ;
1919import * as is from 'is' ;
2020import { Query , QueryProto } from './query' ;
21+ import { PathType } from '.' ;
2122
2223// tslint:disable-next-line no-namespace
2324export namespace entity {
@@ -162,7 +163,7 @@ export namespace entity {
162163
163164 export interface KeyOptions {
164165 namespace ?: string ;
165- path : Array < string | number > ;
166+ path : PathType [ ] ;
166167 }
167168
168169 /**
Original file line number Diff line number Diff line change @@ -37,8 +37,7 @@ import {Transaction} from './transaction';
3737
3838const { grpc} = new GrpcClient ( ) ;
3939
40- // tslint:disable-next-line: no-any
41- export type PathType = any ;
40+ export type PathType = string | number | entity . Int ;
4241
4342// Import the clients for each version supported by this package.
4443const gapic = Object . freeze ( {
@@ -701,13 +700,13 @@ class Datastore extends DatastoreRequest {
701700 * });
702701 */
703702 key ( options : string | entity . KeyOptions | PathType [ ] ) : entity . Key {
704- options = is . object ( options )
705- ? options
703+ const keyOptions = is . object ( options )
704+ ? ( options as entity . KeyOptions )
706705 : {
707706 namespace : this . namespace ,
708707 path : arrify ( options ) as PathType [ ] ,
709708 } ;
710- return new entity . Key ( options as entity . KeyOptions ) ;
709+ return new entity . Key ( keyOptions ) ;
711710 }
712711
713712 /**
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ describe('Datastore', () => {
159159 const [ entity ] = await datastore . get ( postKey ) ;
160160 delete entity [ datastore . KEY ] ;
161161 assert . deepStrictEqual ( entity , data ) ;
162- await datastore . delete ( datastore . key ( [ 'Post' , assignedId ] ) ) ;
162+ await datastore . delete ( datastore . key ( [ 'Post' , assignedId as string ] ) ) ;
163163 } ) ;
164164
165165 it ( 'should save/get/delete with a generated key id' , async ( ) => {
You can’t perform that action at this time.
0 commit comments