mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Add type safety when defining model's attributes
This commit is contained in:
Vendored
+15
-1
@@ -4672,6 +4672,20 @@ declare namespace sequelize {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for Attributes provided for a column
|
||||
*
|
||||
* @see Sequelize.define
|
||||
*/
|
||||
type DefineModelAttributes<T> = {
|
||||
|
||||
/**
|
||||
* The description of a database column for model
|
||||
*/
|
||||
[P in keyof T]: string | DataTypeAbstract | DefineAttributeColumnOptions;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for query options
|
||||
*
|
||||
@@ -5976,7 +5990,7 @@ declare namespace sequelize {
|
||||
* @param options These options are merged with the default define options provided to the Sequelize
|
||||
* constructor
|
||||
*/
|
||||
define<TInstance, TAttributes>(modelName: string, attributes: DefineAttributes,
|
||||
define<TInstance, TAttributes>(modelName: string, attributes: DefineModelAttributes<TAttributes>,
|
||||
options?: DefineOptions<TInstance>): Model<TInstance, TAttributes>;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user