Typescript generic schema usage
See original GitHub issueDo you want to request a feature or report a bug? BUG
What is the current behavior? Typescript isn’t shouting on missing properties, but it does shouting on extra properties or different naming properties.
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
Typescript isn’t shouting on missing properties, but it does shouting on extra properties or different naming properties.
For example, in the above code, property b
is missing in the schema, everything seems to work. (typescript compiled without errros)
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that “latest” is not a version.
- Node LTS (14.17)
- Mongo 4.3
- Mongoose 6.0.4
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
How To Use Generics in TypeScript - DigitalOcean
When creating interfaces and classes in TypeScript, it can be useful to use generic type parameters to set the shape of the resulting...
Read more >Typescript Generics Explained - Ross Bulat - Medium
The implementation of generics in Typescript give us the ability to pass in a range of types to a component, adding an extra...
Read more >Documentation - Generics - TypeScript
When you begin to use generics, you'll notice that when you create generic functions like identity , the compiler will enforce that you...
Read more >Define TypeScript type based on generic type - Stack Overflow
Depending on ContentType I am saving different JSON schema into data column into my database. Example: For IMAGE , saving {"path": "/foo/bar", " ......
Read more >In-Depth Look at TypeScript Generics: Part 1 — Intro to Generics
In this two-part series, we will take an in-depth look at TypeScript generics. This first post will give you a basic understanding of ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@GalDayan you can work around this by using a separate type definition for the schema definition object as shown below.
Got ya. Is there any option to make it required and not partial? @vkarpov15