Typescript declaration file just creating secondary definition instead of replacing interface

  Kiến thức lập trình

I’m using mongoose-delete and its types package @types/mongoose-delete. There is a problem with one of their interface declarations, so I’ve tried to augment it like so…

// mongoose-soft-delete.d.ts
import mongoose from 'mongoose';
import 'mongoose-delete';

declare module 'mongoose-delete' {
  interface SoftDeleteModel<
    T,
  //.. the rest of the owl
  >
}

It’s only half working in that – now I have two definitions for SoftDeleteModel. How do I get it to replace the other instead? The original declaration is like

import mongoose = require("mongoose");

declare namespace MongooseDelete {
    interface SoftDeleteModel<
        T extends Omit<mongoose.Document, "delete">,
    // ...
  }
}

When I try to include the namespace value, it does not work at all.

New contributor

Jim Halpert is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT