1amageek / pring.ts

Cloud Firestore model framework for TypeScript - Google
https://firebase.google.com/docs/firestore/
MIT License
108 stars 7 forks source link

Error: `TypeError: Cannot read property 'length' of undefined` #22

Closed starhoshi closed 6 years ago

starhoshi commented 6 years ago

Error

   TypeError: Cannot read property 'length' of undefined
       at User.Base.init (/user_code/node_modules/pring/src/pring.js:145:78)
       at Function.<anonymous> (/user_code/node_modules/pring/src/pring.js:106:40)
       at step (/user_code/node_modules/pring/src/pring.js:42:23)
       at Object.next (/user_code/node_modules/pring/src/pring.js:23:53)
       at fulfilled (/user_code/node_modules/pring/src/pring.js:14:58)
       at process._tickDomainCallback (internal/process/next_tick.js:135:7)

Code

export class User extends Pring.Base { }

const user = <User>await Model.User.get(user.id) // error!

An error occurs because the User property count is zero.

1amageek commented 6 years ago

Fixed