question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Types of props inside schema consutructor not working

See original GitHub issue

Do you want to request a feature or report a bug? bug

What is the current behavior? image

If the current behavior is a bug, please provide the steps to reproduce. After updating to the last version and removed @types/mongoose to depend on current version types when i create a schema types not autocomplete like the picture below, when i reviewd generic types of schema i found out that, the third generic type which is SchemaDefinitionType = undefined by default!

image

What is the expected behavior? image

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that “latest” is not a version.

 "typescript": "^4.1.5",
 "mongodb": "^3.6.4",
 "mongoose": "^5.11.16",

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ahmednaser94commented, Feb 22, 2021

@ShadiestGoat

I tried to pass the interface as a third parameter and it works now, thanks

1reaction
ShadiestGoatcommented, Feb 22, 2021

@ahmednaser94

new Schema<InterfaceYouWant & Document, Model<InterfaceYouWant & Document>, InterfaceYouWant> {}

Most certainly is for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

prop({default: {}}) does not work correctly for nested documents
typegoose/typegoose": "^6.1.2" When working with documents of strong structure, properties pointing to the default sub-document do not work ...
Read more >
React How to fix Failed prop type - Invalid prop of type string ...
Try console. log of "errors" in the component where Login component is rendered to see what value is getting set.
Read more >
Error & Warning Details - typegoose
Typegoose uses the property OptionsConstructor on types (like mongoose.Schema.Types.ObjectId.OptionsConstructor ) to correctly map the options (from @prop( ...
Read more >
Working with nullable reference types - EF Core
Working with C# nullable reference types when using Entity Framework Core.
Read more >
React Props - W3Schools
React Props are like function arguments in JavaScript and attributes in HTML. ... If you have a variable to send, and not a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found