Skip to content

Commit 363381f

Browse files
Robin BuschmannRobin Buschmann
authored andcommitted
Model interface fix (CreateOptions -> ICreateOptions)
1 parent 998b503 commit 363381f

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

lib/interfaces/ICreateOptions.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {InstanceSaveOptions} from 'sequelize';
2+
import {IBuildOptions} from "./IBuildOptions";
3+
4+
/**
5+
* Options for Model.create method
6+
*/
7+
export interface ICreateOptions extends IBuildOptions, InstanceSaveOptions {
8+
9+
/**
10+
* On Duplicate
11+
*/
12+
onDuplicate?: string;
13+
}

lib/models/Model.d.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,13 @@ import {
1414
} from 'sequelize';
1515
import {IAssociationActionOptions} from "../interfaces/IAssociationActionOptions";
1616
import {IBuildOptions} from "../interfaces/IBuildOptions";
17+
import {ICreateOptions} from "../interfaces/ICreateOptions";
1718

1819
/* tslint:disable:member-ordering */
1920
/* tslint:disable:array-type */
2021
/* tslint:disable:max-line-length */
2122
/* tslint:disable:max-classes-per-file */
2223

23-
// Webstorm cannot resolve "Partial" type automatically,
24-
// so we write our own one
25-
type _Partial<T> = {
26-
[P in keyof T]?: T[P];
27-
};
28-
2924
/**
3025
* Creates override for sequelize model to make the food
3126
*/
@@ -306,8 +301,8 @@ export declare class Model<T> extends Hooks {
306301
/**
307302
* Builds a new model instance and calls save on it.
308303
*/
309-
static create<T extends Model<T>>(values?: any, options?: CreateOptions): Promise<T>;
310-
static create<T extends Model<T>, A>(values?: A, options?: CreateOptions): Promise<T>;
304+
static create<T extends Model<T>>(values?: any, options?: ICreateOptions): Promise<T>;
305+
static create<T extends Model<T>, A>(values?: A, options?: ICreateOptions): Promise<T>;
311306

312307
/**
313308
* Find a row that matches the query, or build (but don't save) the row if none is found.

0 commit comments

Comments
 (0)