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

[Types] mongoose 6.4.0 (PR 11563) broke explicitly set property types #11960

Closed
2 tasks done
hasezoey opened this issue Jun 20, 2022 · 4 comments · Fixed by #11986
Closed
2 tasks done

[Types] mongoose 6.4.0 (PR 11563) broke explicitly set property types #11960

hasezoey opened this issue Jun 20, 2022 · 4 comments · Fixed by #11986
Labels
typescript Types or Types-test related issue / Pull Request
Milestone

Comments

@hasezoey
Copy link
Collaborator

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

6.4.0

Node.js version

any

MongoDB server version

any

Description

With mongoose 6.4.0 (i think because of #11563) the explicitly set property types are ignored and so break subdocuments, subdocument arrays and maps (and probably other types that require more than explicit objects or get transformed)

Steps to Reproduce

  1. clone https://github.com/typegoose/typegoose-testing/
  2. checkout branch mongoose6.4.0typebreak
  3. run yarn install (or equivalent)
  4. inspect the types either via something like vscode or run yarn run build (or equivalent)

this branch also contains commits for previous versions:

Expected Behavior

All types to work like in the previous minor version / explicitly set types to overwrite inferred types

@IslandRhythms IslandRhythms added the typescript Types or Types-test related issue / Pull Request label Jun 21, 2022
@vkarpov15 vkarpov15 added this to the 6.4.1 milestone Jun 21, 2022
vkarpov15 added a commit that referenced this issue Jun 24, 2022
vkarpov15 added a commit that referenced this issue Jun 24, 2022
vkarpov15 added a commit that referenced this issue Jun 25, 2022
fix(types): avoid adding non-existent properties from model constructor for typegoose
@hasezoey
Copy link
Collaborator Author

Can confirm that installing 3a4ba27 (current latest master) fixes all mentioned issues in the reproduction repository branch

@vkarpov15
Copy link
Collaborator

Thanks @hasezoey , and I'm sorry for the inconvenience. We'll ship 6.4.1 on Monday.

@hasezoey
Copy link
Collaborator Author

hasezoey commented Jun 28, 2022

i have just now tried version 6.4.1 and noticed that when using new Model everything is fine, but when trying to use Model.create the wrong types appear again for everything (maybe create was not updated only new?)

see https://github.com/typegoose/typegoose-testing/tree/mongoose6.4.0typebreak (95db7220ed70c4a767e34f9369fa43035a029a72)


Edit: i have extended the test case initially added for this issue in #12001

hasezoey added a commit to hasezoey/mongoose that referenced this issue Jun 28, 2022
hasezoey added a commit to hasezoey/mongoose that referenced this issue Jun 28, 2022
vkarpov15 added a commit that referenced this issue Jul 1, 2022
@vkarpov15
Copy link
Collaborator

Thanks for identifying these issues @hasezoey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript Types or Types-test related issue / Pull Request
Projects
None yet
3 participants