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
ts bug: toConstructor(): typeof Query<ResultType, DocType, THelpers, RawDocType>; #12688
Comments
I also have the same problem, downgrading to 6.6.3 does help for me. I think it has to do with this commit: 86ca628. So reverting to 6.6.3 does change this line back to |
Possibly a duplicate of #12529 though i still dont understand why this error occurs, because i cannot reproduce it in any project and from what i can tell, the syntax is correct @simllll did you already confirm the following things (if yes, could you also provide them?):
|
Hi @hasezoey, it's indeed strange... i was looking into it again , and tested different typescript versions. I need to go deeper why it's happening on our side, as we actually have tsc 4.8.4 everywhere, but my result shows that it only happens with tsc < 4.7. tsc 4.6.4: $ npx tsc-files --noEmit types/query.d.ts FAILS |
fix(types): avoid typeof Query with generics for TypeScript 4.6 support
Prerequisites
Mongoose version
6.7.2
Node.js version
16.x
MongoDB server version
5.x
Typescript version (if applicable)
4.8.4
Description
somehow this fails now suddenly:
../../node_modules/mongoose/types/query.d.ts(619,34): error TS1144: '{' or ';' expected.
../../node_modules/mongoose/types/query.d.ts(619,45): error TS1005: '>' expected.
../../node_modules/mongoose/types/query.d.ts(619,77): error TS1109: Expression expected.
../../node_modules/mongoose/types/query.d.ts(622,19): error TS1109: Expression expected.
../../node_modules/mongoose/types/query.d.ts(622,41): error TS1109: Expression expected.
../../node_modules/mongoose/types/query.d.ts(622,50): error TS1109: Expression expected.
../../node_modules/mongoose/types/query.d.ts(622,73): error TS1005: '(' expected.
../../node_modules/mongoose/types/query.d.ts(622,114): error TS1109: Expression expected.
../../node_modules/mongoose/types/query.d.ts(622,138): error TS1005: '(' expected.
the change was made already some weeks ago, but the line is definitly wrong:
toConstructor(): typeof Query<ResultType, DocType, THelpers, RawDocType>;
Query is already a Class and therefore typeof should just get removed.
change line 619 to
toConstructor(): Query<ResultType, DocType, THelpers, RawDocType>;
fixes it
Steps to Reproduce
just open the query.d.ts file in your favourite IDE :)
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: