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

Setters property of schema types not available in TS declarations #14879

Closed
2 tasks done
shawnmcknight opened this issue Sep 10, 2024 · 0 comments · Fixed by #14881
Closed
2 tasks done

Setters property of schema types not available in TS declarations #14879

shawnmcknight opened this issue Sep 10, 2024 · 0 comments · Fixed by #14881
Milestone

Comments

@shawnmcknight
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

8.6.1

Node.js version

20.13.1

MongoDB server version

7.0.8

Typescript version (if applicable)

5.5.2

Description

In #13538 , a new static setters property was added to several schema type classes as well as an instance setters property to the base SchemaType class. These properties are not available in the TS declaration files, so accessing the setters property is issuing a type error.

image

Steps to Reproduce

mongoose.Schema.Types.String.setters.push((val?: unknown) => val);

Type error will occur on the access of the missing setters property.

Expected Behavior

The setters property should allow pushing a setter function without type error.

@vkarpov15 vkarpov15 added this to the 8.6.2 milestone Sep 10, 2024
vkarpov15 added a commit that referenced this issue Sep 11, 2024
types: make SchemaType static `setters` property accessible in TypeScript
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 a pull request may close this issue.

2 participants