Skip to content

support null value include in @Scopes #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2017

Conversation

hiradimir
Copy link
Contributor

@hiradimir hiradimir commented Aug 16, 2017

I got error of below log and fixed it.
This error occurred by null value in @Scopes.

/home/user/app/node_modules/sequelize-typescript/lib/utils/object.js:10
            .getOwnPropertyNames(source)
             ^
TypeError: Cannot convert undefined or null to object
    at Function.getOwnPropertyNames (<anonymous>)
    at /home/user/app/node_modules/sequelize-typescript/lib/utils/object.js:10:14
    at Array.forEach (native)
    at deepAssign (/home/user/app/node_modules/sequelize-typescript/lib/utils/object.js:8:13)
    at assign (/home/user/app/node_modules/sequelize-typescript/lib/utils/object.js:34:21)
    at /home/user/app/node_modules/sequelize-typescript/lib/utils/object.js:11:46
    at Array.forEach (native)

@@ -46,8 +46,10 @@ export function deepAssign(target: any, ...sources: any[]): any {
} else if (sourceValue instanceof Date) {

targetValue = new Date(sourceValue);
} else {
} else if (sourceValue === null) {
Copy link
Contributor Author

@hiradimir hiradimir Aug 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above L39 condition of
} else if (typeof sourceValue === 'object') {
is true if sourceValue = null.

image


and null value is occurring exception with below else sesion deepAssign

image

@RobinBuschmann
Copy link
Member

Thank you - looks good :)

@RobinBuschmann RobinBuschmann merged commit b1cfa77 into sequelize:master Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants