To repro: cd DefinitelyTyped/types/mongoose && tsc; observe that there are 74 errors, 2 more than the expected 72.
const locationSchema = new mongoose.Schema({
name: { type: String, required: true },
address: String,
rating: { type: Number, "default": 0, min: 0, max: 5 },
facilities: [String],
coords: { type: [Number], index: "2dsphere" },
openingTimes: [mongoose.Schema.Types.Mixed],
reviews: [mongoose.SchemaTypes.Mixed],
notes: [noteSchema]
});
var LocModel = mongoose.model<Location>("Location", locationSchema);
LocModel.create({ address: "foo", coords: [1, 2], facilities: ["foo", "bar"], name: "bar", openingTimes: ["foo"], rating: 10, reviews: ["foo"], notes: [] });
Actual:
At mongoose/test/model.ts:613, errors on openingTimes and reviews:
ERROR: 613:107 expect [email protected] compile error:
No overload matches this call.
The last overload gave the following error.
Type 'string' is not assignable to type 'never'.
Type 'string' is not assignable to type 'never'.
Expected: No error; the input type was [mongoose.SchemeTypes.Mixed], which should result in string[] not never[]
Likely related to #42336, although in this case we can't ship with this error in mongoose, which may involve fixing mongoose in some way.
To repro:
cd DefinitelyTyped/types/mongoose && tsc; observe that there are 74 errors, 2 more than the expected 72.Actual:
At mongoose/test/model.ts:613, errors on openingTimes and reviews:
Expected: No error; the input type was
[mongoose.SchemeTypes.Mixed], which should result instring[]notnever[]Likely related to #42336, although in this case we can't ship with this error in mongoose, which may involve fixing mongoose in some way.