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: typeof Query results into invalid syntax of query.d.ts file #12689

Closed
wants to merge 1 commit into from

Conversation

simllll
Copy link
Contributor

@simllll simllll commented Nov 14, 2022

Summary

right now I cannot compile my proecjt, due to #12688

image

@simllll simllll changed the title fixes #12688 types: typeof Query results into invalid syntax of query.d.ts file Nov 16, 2022
@simllll
Copy link
Contributor Author

simllll commented Nov 16, 2022

@vkarpov15 we are experienceing this issue on more and more projects... please consider this fix

@hasezoey
Copy link
Collaborator

as i had already noted in #12529 (comment), typeof Query is the correct type, where as just Query would be the wrong type.
This is because by default in typescript a type of a class without typeof refers to a instance of the class, where as with typeof it refers to the constructor / static of a class

Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

It looks like in #12688 the issue is that you're using an older version of TypeScript, v4.6.x. Furthermore, the original issue mentions that this issue shows up in your IDE, not when you actually compile with TypeScript.

Also, as @hasezoey mentioned, the change you proposed is incorrect. We'll investigate and see if there is a better workaround for "this function returns this class" rather than "this function returns an instance of this class" that is compatible with TypeScript 4.6.

typeof this works in TypeScript 4.6, but it doesn't work in TypeScript < 4.4. On the other hand, typeof Query<ResultType, DocType, THelpers, RawDocType>; works fine in TypeScript < 4.4 but not TypeScript 4.6 🤦

@vkarpov15
Copy link
Collaborator

Related 86ca628

@simllll
Copy link
Contributor Author

simllll commented Nov 21, 2022

I will investigate on my site, as we actually use TS 4.8... something seems to install an old TS Version.. anyways, the issue is like you said and my fix is wrong, you can close my PR.

@vkarpov15 vkarpov15 closed this Nov 22, 2022
@simllll simllll deleted the patch-6 branch November 22, 2022 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants