1amageek/pring.ts

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

starhoshi opened this issue · 1 comments

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.

Fixed