Skip to content

types: remove logic that omits timestamps when virtuals, methods, etc. options set - #15577

Merged
vkarpov15 merged 1 commit into
8.18from
vkarpov15/gh-12807
Aug 13, 2025
Merged

types: remove logic that omits timestamps when virtuals, methods, etc. options set#15577
vkarpov15 merged 1 commit into
8.18from
vkarpov15/gh-12807

Conversation

@vkarpov15

Copy link
Copy Markdown
Collaborator

Fix #12807

Summary

Looks like the original issue from #12807 just went away, either due to a recent TypeScript release or some other fix we did. This fix would have still worked in 8.17.0, but not 8.16.0

Examples

@vkarpov15 vkarpov15 added this to the 8.18 milestone Aug 11, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the TypeScript logic that excluded timestamp inference when virtuals, methods, or statics options were set in Mongoose schemas. The change fixes issue #12807 by enabling proper type inference for schemas with timestamps alongside other schema options.

  • Updates test to verify timestamp inference works with methods
  • Removes outdated documentation about timestamp inference limitations
  • Adds verification that both model properties and methods maintain correct typing

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
test/types/schema.test.ts Updates type inference test to verify timestamps work with methods and adds model instantiation test
docs/typescript/schemas.md Removes documentation about timestamp inference limitation with methods/virtuals/statics

@hasezoey hasezoey left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@hasezoey hasezoey added the typescript Types or Types-test related issue / Pull Request label Aug 11, 2025
@vkarpov15
vkarpov15 changed the base branch from master to 8.18 August 13, 2025 17:32
@vkarpov15
vkarpov15 merged commit 6f52dcb into 8.18 Aug 13, 2025
7 checks passed
@hasezoey
hasezoey deleted the vkarpov15/gh-12807 branch August 14, 2025 08:25
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.

Properties with unknown type in the mongoose model when set timestamps to true in v6.8.0

3 participants