Skip to content

Commit

Permalink
fix: Correct issues seen in #47
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Sep 2, 2016
1 parent 327719d commit 1f4e26a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Place your settings in this file to overwrite default and user settings.
{
"tslint.enable": true,
"tslint.configFile": "tslint.json"
"tslint.configFile": "tslint.json",
"typescript.tsdk": "node_modules/typescript/lib"
}
2 changes: 1 addition & 1 deletion lib/ModelHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class ModelHelpers<TDocument extends { _id?: any }, TInstance> {
* @param {any} The document you wish to clone deeply.
*/
cloneDocument<T>(original: T): T {
return _.cloneDeepWith(original, (value) => {
return _.cloneDeepWith<T, any>(original, (value) => {
if(Buffer.isBuffer(value)) {
return value;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/utils/Omnom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Omnom {
private onObject(original: any, modified: any, changePath?: string): void {
if (changePath) {
if (original === undefined || original === null)
return (original !== modified) && this.set(changePath, modified);
return <never>(original !== modified) && this.set(changePath, modified);

if (typeof original === "number" && typeof modified === "number" && original !== modified) {
if (this.options.atomicNumbers) return this.inc(changePath, modified - original);
Expand All @@ -59,10 +59,10 @@ export class Omnom {
return this.onArray(original, modified, changePath);

if (original instanceof MongoDB.ObjectID && modified instanceof MongoDB.ObjectID)
return !original.equals(modified) && this.set(changePath, modified);
return <never>!original.equals(modified) && this.set(changePath, modified);

if (!_.isPlainObject(original) || !_.isPlainObject(modified))
return !_.isEqual(original, modified) && this.set(changePath, modified);
return <never>!_.isEqual(original, modified) && this.set(changePath, modified);
}

if (!_.isPlainObject(original) || !_.isPlainObject(modified)) {
Expand Down

0 comments on commit 1f4e26a

Please sign in to comment.