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

fix(types): avoid typeof Query with generics for TypeScript 4.6 support #12712

Merged
merged 1 commit into from Nov 23, 2022

Conversation

vkarpov15
Copy link
Collaborator

Fix #12688
Fix #12689

Summary

A more robust fix for #12689, which mostly does what we expect. It looks like we do lose the generics with toConstructor(), but I think this approach is better than Mongoose compilation crashing on TypeScript 4.6.

Examples

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

maybe consider adding a TODO or REFACTOR comment to update this part for the next major version (which presumably will set the minimal typescript version instead of being vaguely defined)

@hasezoey hasezoey added this to the 6.7.3 milestone Nov 23, 2022
@hasezoey hasezoey added the typescript Types or Types-test related issue / Pull Request label Nov 23, 2022
@vkarpov15 vkarpov15 modified the milestones: 6.7.3, 6.7.4 Nov 23, 2022
@vkarpov15 vkarpov15 merged commit d909525 into master Nov 23, 2022
@hasezoey hasezoey deleted the vkarpov15/gh-12688 branch November 23, 2022 18:28
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
Development

Successfully merging this pull request may close these issues.

ts bug: toConstructor(): typeof Query<ResultType, DocType, THelpers, RawDocType>;
4 participants