Type alias InferCreationAttributes<M, Options>

InferCreationAttributes<M, Options>: { [ 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.

Example

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;
}

Type Parameters

Generated using TypeDoc