Type Alias InferCreationAttributes<M, Options>

InferCreationAttributes: {
    [Key in keyof M as InternalInferAttributeKeysFromFields<M, Key, Options>]: IsBranded<
        M[Key],
        typeof CreationAttributeBrand,
    > extends true
        ? M[Key]
        | undefined
        : M[Key]
}

Utility type to extract Creation Attributes of a given Model class.

Works like InferAttributes, but fields that are tagged using CreationOptional will be optional.

Type Parameters

class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
// this attribute is optional in Model#create
declare id: CreationOptional<number>;

// this attribute is mandatory in Model#create
declare name: string;
}