-
Notifications
You must be signed in to change notification settings - Fork 92
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
Inconsistent declaration of Query #220
Comments
A solution to this problem is replacing the type parameter for interface Query<
ResultType,
DocType,
THelpers = NonNullable<unknown>,
RawDocType = unknown,
QueryOp = 'find',
TInstanceMethods = Record<string, never>,
> {
paginate<O extends PaginateOptions>(
options?: O
): Promise<PaginateResult<PaginateDocument<RawDocType, TInstanceMethods, O>>>
paginate<UserType = ResultType, O extends PaginateOptions = PaginateOptions>(
options?: O
): Promise<PaginateResult<PaginateDocument<UserType, TInstanceMethods, O>>>
paginate<UserType = ResultType>(
options?: PaginateOptions
): Promise<PaginateResult<PaginateDocument<UserType, TInstanceMethods, PaginateOptions>>>
} |
also we can ignore the error by placing the following line before the interface: // @ts-expect-error overwriting of mongoose Query interface as in #221 |
Thanks for the fix. @twibster |
This is still not fixed as of 1.9.0. The @ts-ignore commit does not work because the error still shows in the mongoose declaration: node_modules/.pnpm/mongoose@8.9.3/node_modules/mongoose/types/query.d.ts:241:9 - error TS2428: All declarations of 'Query' must have identical type parameters.
241 class Query<ResultType, DocType, THelpers = {}, RawDocType = unknown, QueryOp = 'find', TDocOverrides = Record<string, never>> implements SessionOperation {
~~~~~ |
@Clashsoft Please see if it works with v1.8.5 |
Nope.
mongoose-paginate-v2
mongoose
|
Describe the bug
On the latest version of mongoose (8.6.3), There is a difference in
RawDocType
parameter type (unknown
) in the Query class in mongoose.d.ts:and Query interface in index.d.ts (Ref to
DocType
) from the package here:which is causing an inconsistent declaration error in TypeScript
To Reproduce
1- building the application or whatever using the package and mongoose
Expected behavior
A matching declaration of Query in the package and in mongoose
The text was updated successfully, but these errors were encountered: