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.

How to create fully typed model?

See original GitHub issue

Summary:

Currently, when creating a new model the model type is simply Document. I believed the same approach can be taken as with mongoose and just supply interface when creating new model.

export default mongoose.model<IUser>('User', UserSchema);

But with dynamoose doing so will result in an error:

Type ‘Stat’ does not satisfy the constraint ‘Document’.

With mongoose, it is easy to simply have your interface extend mongoose’s Document interface, however, I can’t seem to find a way to access Document interface in dynamoose as it seems to not be exported.

What is the recommended route to create fully typed Models?

Other:

  • I have read through the Dynamoose documentation before posting this issue
  • I have searched through the GitHub issues (including closed issues) and pull requests to ensure this question has not already been raised before
  • I have searched the internet and Stack Overflow to ensure this question hasn’t been raised or answered before
  • I have filled out all fields above
  • I am running the latest version of Dynamoose

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pfulopcommented, May 9, 2020

@fishcharlie I will give it a try.

0reactions
github-actions[bot]commented, May 18, 2020

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 3 days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Comprehensive Guide to Build your own Language Model ...
Text Summarization, generating completely new pieces of text, ... We can build a language model in a few lines of code using the...
Read more >
How To Create Custom Types in TypeScript - DigitalOcean
In TypeScript, the syntax for creating custom types is to use the type ... You can use intersection types to create a completely...
Read more >
Strongly Typed Model Views | ASP.NET MVC Tutorial - YouTube
Chapters. View all · Introduction · Introduction · Introduction · Create New Project · Create New Project · Create New Project · Create...
Read more >
Creating model classes in TypeScript - Stack Overflow
Types can be combined and should be used more for non-composite properties. ... Step 1: Create your model using “Classes”.
Read more >
Making Our Own Types and Typeclasses - Learn You a Haskell
By using record syntax to create this data type, Haskell automatically made ... We want to keep track of the company that made...
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