CreationOptional<T>: T extends null | undefined
    ? T
    : T & {
        [CreationAttributeBrand]?: true;

This is a Branded Type. You can use it to tag attributes that can be omitted during Model Creation. Use it on attributes that have a default value or are marked as autoIncrement.

For use with InferCreationAttributes.

Type Parameters

  • T


class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
declare internalId: CreationOptional<number>;

@Default('John Doe')
declare name: CreationOptional<string>;