The @Default decorator is used to set a default value for an attribute, it is a shortcut for setting the defaultValue option of the Attribute decorator.
@Default
defaultValue
class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> { @Attribute(DataTypes.STRING) @Default('John Doe') declare firstName: string;} Copy
class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> { @Attribute(DataTypes.STRING) @Default('John Doe') declare firstName: string;}
The
@Default
decorator is used to set a default value for an attribute, it is a shortcut for setting thedefaultValue
option of the Attribute decorator.