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

[BUG] Recent npm upgrade breaks schema compatibility #386

Open
chongma opened this issue Apr 9, 2021 · 2 comments
Open

[BUG] Recent npm upgrade breaks schema compatibility #386

chongma opened this issue Apr 9, 2021 · 2 comments
Labels

Comments

@chongma
Copy link

chongma commented Apr 9, 2021

Describe the bug
A clear and concise description of what the bug is.

I am doing the course https://www.udemy.com/course/microservices-with-node-js-and-react by Stephen Grider which makes use of this plugin. I was recently prompted to upgrade npm and now I get the following stack trace

[orders] [ERROR] 10:42:32 ⨯ Unable to compile TypeScript:
[orders] src/models/ticket.ts(43,21): error TS2345: Argument of type '(schema: Schema<Document<any, {}>, Model<any, any>, undefined>, options?: PluginOptions | undefined) => void' is not assignable to parameter of type '(schema: Schema<TicketDoc, Model<TicketDoc, {}>, undefined>, opts?: any) => void'.
[orders]   Types of parameters 'schema' and 'schema' are incompatible.
[orders]     Type 'Schema<TicketDoc, Model<TicketDoc, {}>, undefined>' is not assignable to type 'Schema<Document<any, {}>, Model<any, any>, undefined>'.
[orders]       Types of property 'methods' are incompatible.
[orders]         Type '{ [name: string]: (this: TicketDoc, ...args: any[]) => any; }' is not assignable to type '{ [name: string]: (this: Document<any, {}>, ...args: any[]) => any; }'.
[orders]           Index signatures are incompatible.
[orders]             Type '(this: TicketDoc, ...args: any[]) => any' is not assignable to type '(this: Document<any, {}>, ...args: any[]) => any'.
[orders]               The 'this' types of each signature are incompatible.
[orders]                 Type 'Document<any, {}>' is not assignable to type 'TicketDoc'.

ticket.txt

Line 43 is where the plugin is. The file is ticket.ts which is typescript

ticketSchema.plugin(updateIfCurrentPlugin)

To Reproduce
Steps to reproduce the behavior and/or a minimal code sample or link to a repository that reproduces the behavior.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Platform: Fedora 33
  • Node.js version: v14.16.0
  • Mongoose version: 5.11.10

Additional context
Add any other context about the problem here.

@chongma chongma added the bug label Apr 9, 2021
@sharmarajdaksh
Copy link

Can confirm. Facing the same issue on Ubuntu 20.04.02 with Node v15.0.1 and mongoose 5.12.10

NHamata pushed a commit to NHamata/mongoose-update-if-current that referenced this issue Aug 5, 2021
@NHamata
Copy link

NHamata commented Aug 5, 2021

I fixed this and made a PR, im sure its ok to just use ts supression for now.

// @ts-ignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants