Skip to content

Conversation

@vkarpov15
Copy link
Collaborator

Fix #14879

Summary

There are places in the docs where we recommend pushing default setters to schematypes like mongoose.Schema.String.setters.push(fn), but TypeScript types currently don't support that.

Examples

@vkarpov15 vkarpov15 added this to the 8.6.2 milestone Sep 10, 2024
@hasezoey hasezoey added the typescript Types or Types-test related issue / Pull Request label Sep 11, 2024
static get(getter: (value: any) => any): void;

/** Array containing default setters for all instances of this SchemaType */
static setters: Function[];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static setters: Function[];
static setters: ((val?: unknown) => unknown)[];

i think it is better with known arguments, unless there are more arguments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's technically 4 arguments: val, priorVal, doc, options. I'll fix.

@vkarpov15 vkarpov15 merged commit dd7e75e into master Sep 11, 2024
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-14879 branch September 11, 2024 15:48
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

Development

Successfully merging this pull request may close these issues.

Setters property of schema types not available in TS declarations

3 participants