From 8df6b982f305d8bd5b877b02ccd74c6ebde004ff Mon Sep 17 00:00:00 2001 From: Chang Wang Date: Wed, 13 Mar 2019 17:16:53 -0400 Subject: [PATCH] Extend test to ensure TCreationAttributes works --- types/sequelize/sequelize-tests.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 3a13906f06..233de49f07 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -41,19 +41,26 @@ s.transaction().then( ( a ) => t = a ); // ~~~~~~~~~~ // -interface GUserAttributes { - id? : number; +interface GUserCreationAttributes { + id? : number username? : string; email: string; } -interface GUserInstance extends Sequelize.Instance {} -const GUser = s.define('user', { +interface GUserAttributes { + id : number; + username? : string; + email: string; +} + +interface GUserInstance extends Sequelize.Instance, GUserAttributes {} +const GUser = s.define('user', { id: Sequelize.INTEGER, username: Sequelize.STRING, email: Sequelize.STRING }); GUser.create({ id : 1, username : 'one', email: 'one@lol.com' }).then((guser) => guser.save()); +GUser.create({ email: 'two@lol.com' }).then((guser) => guser.save()) var schema : Sequelize.DefineAttributes = { key : { type : Sequelize.STRING, primaryKey : true },