diff --git a/docs/typescript/statics.md b/docs/typescript/statics.md index 4c6f94bfc1c..1d7c2d2738d 100644 --- a/docs/typescript/statics.md +++ b/docs/typescript/statics.md @@ -29,9 +29,9 @@ doc.updateName('foo'); UserModel.createWithName('bar'); ``` -### With Generics +## With Generics -While we recommend using Mongoose's automatic type inference where possible, you may need to override method and static types using generic parameters. +We recommend using Mongoose's automatic type inference where possible, but you can use `Schema` and `Model` generics to set up type inference for your statics and methods. Mongoose [models](../models.html) do **not** have an explicit generic parameter for [statics](guide.html#statics). If your model has statics, we recommend creating an interface that [extends](https://www.typescriptlang.org/docs/handbook/interfaces.html) Mongoose's `Model` interface as shown below. @@ -79,4 +79,4 @@ const User = model('User', schema); const doc = new User({ name: 'test' }); // Compiles correctly doc.updateName('foo'); -``` \ No newline at end of file +```