Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Test does not satisfy the constraint Document<any, any, any>. #24

Open
juliojordan opened this issue Jun 28, 2024 · 0 comments
Open

Comments

@juliojordan
Copy link

Mongoose removed support for extends Document

Removed LeanDocument and support for extends Document. - Mongoose > Migrating from 6.x to 7.x.

How to reproduce it?

Removing the extends Document from the How It Works TypeScript version example.

import * as mongoose from "mongoose";
import { SoftDeleteModel, softDeletePlugin } from "soft-delete-plugin-mongoose";

interface Test {
    name: string;
    lastName: string;
}

const TestSchema = new mongoose.Schema({
    name: String,
    lastName: String,
});

TestSchema.plugin(softDeletePlugin);

const testModel = mongoose.model<Test, SoftDeleteModel<Test>>("Test", TestSchema);

You'll get this error.

./index.ts:16:56 - error TS2344: Type 'Test' does not satisfy the constraint 'Document<any, any, any>'.
  Type 'Test' is missing the following properties from type 'Document<any, any, any>': $assertPopulated, $clone, $getAllSubdocs, $ignore, and 47 more.

16 const testModel = mongoose.model<Test, SoftDeleteModel<Test>>("Test", TestSchema);

I would appreciate any help. Thx.

@juliojordan juliojordan changed the title Type 'Test' does not satisfy the constraint 'Document<any, any, any>'. Type Test does not satisfy the constraint Document<any, any, any>. Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant