diff --git a/types/lib/model.d.ts b/types/lib/model.d.ts index 95c9752838f8..46da75e54c29 100644 --- a/types/lib/model.d.ts +++ b/types/lib/model.d.ts @@ -1109,13 +1109,13 @@ export interface ModelValidateOptions { /** * check the value is not one of these */ - notIn?: ReadonlyArray | { msg: string; args: ReadonlyArray }; + notIn?: ReadonlyArray | { msg: string; args: ReadonlyArray }; /** * check the value is one of these */ - isIn?: ReadonlyArray | { msg: string; args: ReadonlyArray }; - + isIn?: ReadonlyArray | { msg: string; args: ReadonlyArray }; + /** * don't allow specific substrings */ diff --git a/types/test/validators.ts b/types/test/validators.ts new file mode 100644 index 000000000000..56254de307db --- /dev/null +++ b/types/test/validators.ts @@ -0,0 +1,22 @@ +import { DataTypes, Model, Sequelize } from 'sequelize'; + +const sequelize = new Sequelize('mysql://user:user@localhost:3306/mydb'); + +/** + * Test for isIn/notIn validation - should accept any[] + */ +class ValidatedUser extends Model {} +ValidatedUser.init({ + name: { + type: DataTypes.STRING, + validate: { + isIn: [['first', 1, null]] + } + }, + email: { + type: DataTypes.STRING, + validate: { + notIn: [['second', 2, null]] + } + }, +}, { sequelize }); \ No newline at end of file