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

Removal of count() not reflected in types #14062

Closed
2 tasks done
richardsimko opened this issue Nov 8, 2023 · 0 comments · Fixed by #14067
Closed
2 tasks done

Removal of count() not reflected in types #14062

richardsimko opened this issue Nov 8, 2023 · 0 comments · Fixed by #14067
Labels
typescript Types or Types-test related issue / Pull Request
Milestone

Comments

@richardsimko
Copy link

richardsimko commented Nov 8, 2023

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

8.0.0

Node.js version

20.0.0

MongoDB server version

latest

Typescript version (if applicable)

latest

Description

The function Model.count() is still valid in TypeScript even though the function does not exist.

Steps to Reproduce

interface Foo {
  bar: string[];
}

const FooModel = model<Foo>('Foo', new Schema<Foo>({ bar: [String] }));

await FooModel.count()

Results in TypeError: FooModel.count is not a function

Expected Behavior

Compilation error thrown by Typescript.

@vkarpov15 vkarpov15 added the typescript Types or Types-test related issue / Pull Request label Nov 9, 2023
@vkarpov15 vkarpov15 added this to the 8.0.1 milestone Nov 9, 2023
vkarpov15 added a commit that referenced this issue Nov 9, 2023
vkarpov15 added a commit that referenced this issue Nov 14, 2023
types(model+query): correctly remove count from TypeScript types to reflect removal of runtime support
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
2 participants