Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Here we declare a user interface which defines
- * the types for each field inside of the interface.
- */
- export interface UserInterface {
- firstName: string
- lastName: string
- age: number
- email: EmailInterface[]
- }
- /**
- * Here we have a method which accepts the interface we defined above.
- * Attempting to pass this method anything other than an object conforming
- * to the UserInterface will cause a compiler error.
- *
- * You can also see the return value for this method will be a Promise containing
- * the created user which is of type UserModel.
- */
- public static createUser(userData: UserInterface): Bluebird<UserModel> {
- return User.create(userData).then((createdUser: UserModel) => {
- return createdUser
- })
- }
Add Comment
Please, Sign In to add comment