gstore-node supports Typescript. Make sure you have installed the Types definition file for @google-cloud/datastore first:
npminstall--save@types/google-cloud__datastore
Once you have installed the types for google Datastore, you just need to create a custom Type for your schema and pass it to the Schema and Model instance.
It you want to allow other properties apart from those declared (see explicitOnly option in the Schema options), this is how you would create your Model:
typeUserType= { userName:string; email:string; age?:number; // optional tags?:string[]; // optional birthday?:Date; // optional} & {[propName:string]:any}; // Allow any other properties// Schema with "explicitOnly" set to "false"constschema=newSchema<UserType>({ userName: { type: String }, email: { type: String }, age: { type: Number, optional:true }, tags: { type: Array, optional:true }, birthday: { type: Date, optional:true }}, { explicitOnly:false }); // explicitOnly set to "false"constUser=gstore.model<UserType>('User', schema);