Closed hongbo-miao closed 8 years ago
When I use try the code in the example in angular2-meteor,
createdAt: { type: Date, autoValue: function() { if (this.isInsert) { return new Date(); } else if (this.isUpsert) { return {$setOnInsert: new Date()}; } else { this.unset(); } } }
it will give the warning:
No best common type exists among return expressions.
How about changing to this?
createdAt: { type: Date, autoValue: function() { if (this.isInsert) { return new Date(); } else if (this.isUpsert) { return {$setOnInsert: new Date()}; } else { this.unset(); return undefined; // <- add this line } } }
It is related with TypeScript, this is not correct way to avoid the warning. I need more time to confirm
Oh, I got solution here.
When I use try the code in the example in angular2-meteor,
it will give the warning:
How about changing to this?