Fix a type in mongoose tests (#42189)

Previously, Typescript didn't issue strictNullCheck errors on variables
with multiple declarations, like

```ts
var x: E
var y: E | undefined
var x = y // TS should error here, but didn't previously

var z: E | undefined = y // TS already errored here
```

Now it does, and mongoose's tests were missing a now-required `undefined`.
This commit is contained in:
Nathan Shively-Sanders 2020-02-07 09:33:23 -08:00 committed by GitHub
parent ef627d6747
commit 99e183f8ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,7 +216,7 @@ validatorError.stack;
* https://mongoosejs.com/docs/api.html#mongooseerror_MongooseError.ValidationError
*/
var doc = <mongoose.Document>{};
var validationError: mongoose.Error.ValidationError = new mongoose.Error.ValidationError(doc);
var validationError: mongoose.Error.ValidationError | undefined = new mongoose.Error.ValidationError(doc);
validationError.name;
validationError.toString().toLowerCase();
validationError.inspect();