I have trouble to get Typescript excess property checking to work with mongo query functions.
With a schema defined like this
interface MySchema {
str: string;
num: number;
}
With a collection declared like this
const coll : Collection<MySchema> = db.collection("myCollection");
When doing a bogus findOne like this
await coll.findOne({str:"hello", num: 123, foo: "bar"}); //note the additional property foo that doesn't exist in the schema
Typescript correctly type the findOne function with the MySchema, but it doesn’t error with the additional property.
My understanding is that Typescript excess property check should error on the additional property.