Guest User

Untitled

a guest
Jan 4th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. /**
  2. * Here we declare a user interface which defines
  3. * the types for each field inside of the interface.
  4. */
  5. export interface UserInterface {
  6. firstName: string
  7. lastName: string
  8. age: number
  9. email: EmailInterface[]
  10. }
  11.  
  12. /**
  13. * Here we have a method which accepts the interface we defined above.
  14. * Attempting to pass this method anything other than an object conforming
  15. * to the UserInterface will cause a compiler error.
  16. *
  17. * You can also see the return value for this method will be a Promise containing
  18. * the created user which is of type UserModel.
  19. */
  20. public static createUser(userData: UserInterface): Bluebird<UserModel> {
  21. return User.create(userData).then((createdUser: UserModel) => {
  22. return createdUser
  23. })
  24. }
Add Comment
Please, Sign In to add comment