Closed lifeiscontent closed 2 years ago
Works as expected. required
is defined here and the example you pasted is incorrect:
import {Schema} from 'mongoose';
const foo = new Schema({
foo: String,
required: true // <-- tries to define a schema property of type `true`, which is incorrect
})
Do you want to request a feature or report a bug? Bug
What is the current behavior? TypeScript defintions are out of sync with reality
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior? TypeScript definitions work as intended
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Reproduction:
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbwMoGMAWBTEBDAvnAMyghDgHIQIA7AcwggGcMyBuAKDZWofgPrgC8cKhgDucVJhwAKBGziF6ALgkwowWgBp5cKBgCOAV2B6AJirWGMbXAEogA
JavaScript code in relation to issue:
https://github.com/Automattic/mongoose/blob/d459fbe2bbfd542b510e52c2f2d0c073eb3c8714/lib/options/SchemaTypeOptions.js#L95