Makes the attribute reject null values. Opposite of AllowNull. It is a shortcut for setting the allowNull option of the Attribute decorator to false.
allowNull
class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> { @Attribute(DataTypes.STRING) @NotNull declare firstName: string;} Copy
class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> { @Attribute(DataTypes.STRING) @NotNull declare firstName: string;}
Optional
Makes the attribute reject null values. Opposite of AllowNull. It is a shortcut for setting the
allowNull
option of the Attribute decorator to false.Example