Skip to content

Commit

Permalink
fix(model): compatible constructor with sequelize (#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukashroch committed Jun 14, 2022
1 parent cb478e2 commit 4f03520
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"prettyjson": "1.2.5",
"reflect-metadata": "0.1.13",
"release-it": "14.12.4",
"sequelize": "6.16.1",
"sequelize": "6.20.1",
"sinon": "13.0.1",
"sinon-chai": "3.7.0",
"source-map-support": "0.5.21",
Expand All @@ -144,6 +144,6 @@
"@types/node": "*",
"@types/validator": "*",
"reflect-metadata": "*",
"sequelize": ">=6.8.0"
"sequelize": ">=6.20.1"
}
}
3 changes: 2 additions & 1 deletion src/model/model/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ModelAttributes,
FindOptions,
BuildOptions,
Utils,
} from 'sequelize';
import { capitalize } from '../../shared/string';
import { inferAlias } from '../../associations/alias-inference/alias-inference-service';
Expand Down Expand Up @@ -48,7 +49,7 @@ export abstract class Model<
return super.init<MS, M>(attributes, options);
}

constructor(values?: TCreationAttributes, options?: BuildOptions) {
constructor(values?: Utils.MakeNullishOptional<TCreationAttributes>, options?: BuildOptions) {
if (!new.target.isInitialized) {
throw new ModelNotInitializedError(new.target, `${new.target.name} cannot be instantiated.`);
}
Expand Down

0 comments on commit 4f03520

Please sign in to comment.