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

v6.6.4 breaks typings with mongodb v4.10.0 #12512

Closed
2 tasks done
christos97 opened this issue Oct 3, 2022 · 4 comments
Closed
2 tasks done

v6.6.4 breaks typings with mongodb v4.10.0 #12512

christos97 opened this issue Oct 3, 2022 · 4 comments
Labels
help This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary typescript Types or Types-test related issue / Pull Request

Comments

@christos97
Copy link

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.6.4

Node.js version

14.19.1

MongoDB server version

5.0.12

Description

Updating from 6.6.3 -> 6.6.4 breaks the typings of node_modules/mongoose/types/query.d.ts

Using the current latest version of mongodb npm package (4.10.0)

This error has happened before with different version comboinations.

Its the "classic"

Exrpession expected or '(' expected

We do not have mongoose typings installed separately as a dev depedency,
only mongodb and mongoose packages at the above versions mentioned

Steps to Reproduce

Update versions and run npm install.
The error is coming from within mongoose module typings.

node_modules/mongoose/types/query.d.ts:630:191 - error TS1005: ',' expected.

630     updateMany(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType> | UpdateWithAggregationPipeline, options?: QueryOptions<DocType> | null, callback?: Callback<UpdateWriteOpResult>): QueryWithHelpers<UpdateWriteOpResult, DocType, THelpers, RawDocType>;
                                                                                                                                                                                                  ~

node_modules/mongoose/types/query.d.ts:630:261 - error TS1005: '(' expected.

630     updateMany(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType> | UpdateWithAggregationPipeline, options?: QueryOptions<DocType> | null, callback?: Callback<UpdateWriteOpResult>): QueryWithHelpers<UpdateWriteOpResult, DocType, THelpers, RawDocType>;
                                                                                                                                                                                                                                                                        ~

node_modules/mongoose/types/query.d.ts:636:22 - error TS1109: Expression expected.

636     updateOne(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType> | UpdateWithAggregationPipeline, options?: QueryOptions<DocType> | null, callback?: Callback<UpdateWriteOpResult>): QueryWithHelpers<UpdateWriteOpResult, DocType, THelpers, RawDocType>;
                         ~

node_modules/mongoose/types/query.d.ts:636:44 - error TS1109: Expression expected.

636     updateOne(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType> | UpdateWithAggregationPipeline, options?: QueryOptions<DocType> | null, callback?: Callback<UpdateWriteOpResult>): QueryWithHelpers<UpdateWriteOpResult, DocType, THelpers, RawDocType>;
                                               ~

node_modules/mongoose/types/query.d.ts:636:53 - error TS1109: Expression expected.

636     updateOne(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType> | UpdateWithAggregationPipeline, options?: QueryOptions<DocType> | null, callback?: Callback<UpdateWriteOpResult>): QueryWithHelpers<UpdateWriteOpResult, DocType, THelpers, RawDocType>;
                                                        ~

node_modules/mongoose/types/query.d.ts:636:76 - error TS1005: '(' expected.

636     updateOne(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType> | UpdateWithAggregationPipeline, options?: QueryOptions<DocType> | null, callback?: Callback<UpdateWriteOpResult>): QueryWithHelpers<UpdateWriteOpResult, DocType, THelpers, RawDocType>;
                                                                               ~

node_modules/mongoose/types/query.d.ts:636:117 - error TS1109: Expression expected.

636     updateOne(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType> | UpdateWithAggregationPipeline, options?: QueryOptions<DocType> | null, callback?: Callback<UpdateWriteOpResult>): QueryWithHelpers<UpdateWriteOpResult, DocType, THelpers, RawDocType>;
                                    

Expected Behavior

Since its a patch, this should not happend imho.

@christos97
Copy link
Author

Downgrading to previous patch (6.6.3), works as expected and compiles fine.

@hasezoey
Copy link
Collaborator

hasezoey commented Oct 4, 2022

looks like a too low typescript version is used, maybe try to upgrade the typescript version

officially mongoose uses and tests on typescript 4.8 (since at least 6.6.0), though older typescript versions may get fixes, but it is recommended to upgrade to the latest typescript version

@hasezoey hasezoey added the typescript Types or Types-test related issue / Pull Request label Oct 4, 2022
@christos97
Copy link
Author

Yes upgrading to 4.8 compiles fine.

Thank you. You can close it

"typescript": "~4.8.x"

@Uzlopak Uzlopak closed this as completed Oct 4, 2022
@hasezoey hasezoey added the help This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary label Oct 4, 2022
@christos97
Copy link
Author

Hello again,

Maybe you could add a typescript version in the above issue template (if used)
since it's tightly coupled with bugs.

Just an afterthought of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary typescript Types or Types-test related issue / Pull Request
Projects
None yet
Development

No branches or pull requests

3 participants