-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
typescriptTypes or Types-test related issue / Pull RequestTypes or Types-test related issue / Pull Request
Milestone
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Mongoose version
7.6.7
Node.js version
18.20.3
MongoDB server version
7.0.12
Typescript version (if applicable)
5.2.2
Description
It looks like the typescript signature for SchemaTypes.path().cast require some (what appear to be) optional fields.
I wanted to create a subdocument instance without creating a model. With reference to #9076,
which works exactly as intended with the //@ts-ignore, but otherwise gives me a type error. Upon further examination,
it appears that
doc and init are required fields in the typescript signature, whereas they seem to be optional in a lot of the documentation I've seen.
This is my top-level schema file:
Please let me know if I'm mistaken somewhere, many thanks!!
Steps to Reproduce
Please see above.
Expected Behavior
Optional (?) fields should be required by typescript signature
Metadata
Metadata
Assignees
Labels
typescriptTypes or Types-test related issue / Pull RequestTypes or Types-test related issue / Pull Request