fix(types): avoid inferring timestamps if methods
, virtuals
, or statics
set
#12871
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Re: #12807
Summary
Really not my favorite PR. I haven't been able to figure out exactly why this issue happens, I suspect because there's some self-referential issues that pop up because methods, virtuals, and statics use the inferred document type, and the inferred document type relies on schema options. But this is at least sufficient to unblock anyone using timestamp type inference.
We should consider deprecating
timestamps
type inference for 7.0 if we don't come up with a better solution. I'm going to take some time to come up with a minimal repro script for the TypeScript team. I don't expect this to end up being a bug that TS is willing to fix. But might as well so we can at least be certain that we're trying to do something TypeScript doesn't support.Examples