Skip to content

Commit 4f03520

Browse files
authored
fix(model): compatible constructor with sequelize (#1310)
1 parent cb478e2 commit 4f03520

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
"prettyjson": "1.2.5",
132132
"reflect-metadata": "0.1.13",
133133
"release-it": "14.12.4",
134-
"sequelize": "6.16.1",
134+
"sequelize": "6.20.1",
135135
"sinon": "13.0.1",
136136
"sinon-chai": "3.7.0",
137137
"source-map-support": "0.5.21",
@@ -144,6 +144,6 @@
144144
"@types/node": "*",
145145
"@types/validator": "*",
146146
"reflect-metadata": "*",
147-
"sequelize": ">=6.8.0"
147+
"sequelize": ">=6.20.1"
148148
}
149149
}

src/model/model/model.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
ModelAttributes,
55
FindOptions,
66
BuildOptions,
7+
Utils,
78
} from 'sequelize';
89
import { capitalize } from '../../shared/string';
910
import { inferAlias } from '../../associations/alias-inference/alias-inference-service';
@@ -48,7 +49,7 @@ export abstract class Model<
4849
return super.init<MS, M>(attributes, options);
4950
}
5051

51-
constructor(values?: TCreationAttributes, options?: BuildOptions) {
52+
constructor(values?: Utils.MakeNullishOptional<TCreationAttributes>, options?: BuildOptions) {
5253
if (!new.target.isInitialized) {
5354
throw new ModelNotInitializedError(new.target, `${new.target.name} cannot be instantiated.`);
5455
}

0 commit comments

Comments
 (0)