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.

[QUESTION] How to extend Document

See original GitHub issue

Summary:

Under the Model documentation (https://dynamoosejs.com/guide/Model) there is an example where the Document class is extended to achieve type checking.

The example from the docs

// Strongly typed model
class Cat extends Document {
    id: number;
    name: string;
}
const CatModel = dynamoose.model<Cat>("Cat", {"id": Number, "name": String});

This looks like a neat feature, but how do one get a hold of the Document class/type referred to in this example. I can’t find anywhere on the dynamoose import where it’s exposed?

Thank you.

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
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
hardyscccommented, Nov 30, 2020

@jornki just import it like that

import { Document } from 'dynamoose/dist/Document';
1reaction
hardyscccommented, Nov 26, 2022

Hi @sulemanelahi, here is example

import dynamoose from 'dynamoose';
import { Schema } from 'dynamoose/dist/Schema';

const schema: Schema = new dynamoose.Schema({ .............. });
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I extend the document object? - javascript
I updated your fiddle. The problem you were having is that document object is an instance of the HTMLDocument object type.
Read more >
About Form 4868, Application for Automatic Extension of Time ...
A U.S. citizen or resident files this form to request an automatic extension of time to file a U.S. individual income tax return....
Read more >
Keyboard shortcuts in Word - Microsoft Support
Use your keyboard to navigate your document, ribbon, or menus, ... Alt+W, Q, then use the Tab key in the Zoom dialog box...
Read more >
Employment Authorization Extensions - USCIS
Employment Authorization Document (EAD) Renewal. DHS will automatically extend EADs (Form I-766) for employees with certain EAD category ...
Read more >
Sample i539 Form Extension, Documents (B1/B2, H4 COS)
Documents for H4 Extension. Common Questions; Sample i-539 form; i-539A Sample; Fee Calculator. USCIS Mailing Address ...
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