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

Expression produces a union type that is too complex to represent #563

Closed
tar-aldev opened this issue Jun 18, 2021 · 3 comments
Closed

Expression produces a union type that is too complex to represent #563

tar-aldev opened this issue Jun 18, 2021 · 3 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists | This Feature already exists

Comments

@tar-aldev
Copy link

tar-aldev commented Jun 18, 2021

Versions

  • System: linux
  • NodeJS: 14.16.0
  • Typescript: 4.3.2
  • Typegoose(NPM): ^7.6.0
  • mongoose: <=5.10.18
  • mongodb: ^3.6.9
    "@types/mongoose": "<=5.10.5",

What is the Problem?

Calling .create() on model gives an error:

error TS2590: Expression produces a union type that is too complex to represent.

It happens only in CI for some reason.

Code Example

The code is quite simple, so I don't think it is connected with our typedefinitions

// agreement type is defined as
AgreementFromForm & {
      ownerId: Types.ObjectId;
      createdBy: Agreement['createdBy'];
      createdAt: Agreement['createdAt'];
}

this.agreementModel.create({ // <- errors here
      _id: new Types.ObjectId(),
      ...agreement
});
code here

Do you know why it happens?

no


@tar-aldev tar-aldev added the bug Something isn't working label Jun 18, 2021
@hasezoey
Copy link
Member

Duplicate of #499

@hasezoey hasezoey marked this as a duplicate of #499 Jun 18, 2021
@hasezoey
Copy link
Member

is there an full reproduction code?

and did you already try an higher/lower typescript version?

@hasezoey
Copy link
Member

closing, because duplicate of #499

@hasezoey hasezoey added the duplicate This issue or pull request already exists | This Feature already exists label Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists | This Feature already exists
Projects
None yet
Development

No branches or pull requests

2 participants