chore: introduce TSTyche for type testing#16024
Merged
vkarpov15 merged 6 commits intoAutomattic:masterfrom Feb 23, 2026
Merged
Conversation
mrazauskas
commented
Feb 11, 2026
| @@ -1,4 +1,4 @@ | |||
| import { Schema, model, Document, Model, Types } from 'mongoose'; | |||
| schema.post('save', function(res) { | ||
| ExpectAssignable<HydratedDocument<IDocument>>()(this); | ||
| // @ts-expect-error res should be a document, no query type | ||
| // @ts-expect-error Type 'Document...' is missing the following properties from type 'Query...' |
Contributor
Author
There was a problem hiding this comment.
The messages can be truncated using .... This is a good example.
vkarpov15
approved these changes
Feb 23, 2026
Collaborator
vkarpov15
left a comment
There was a problem hiding this comment.
One minor question but otherwise I love it. This is awesome 😃
package.json
Outdated
| "test-rs": "START_REPLICA_SET=1 mocha --timeout 30000 --exit ./test/*.test.js", | ||
| "test-rs:ci": "npm run test-rs -- --reporter min", | ||
| "test:types": "tsc --project test/types/tsconfig.json", | ||
| "test:types": "tsc --project test/types/tsconfig.json && tstyche", |
Collaborator
There was a problem hiding this comment.
Minor question - is the tsc still required here? I think this script can just be "tstyche"
Contributor
Author
There was a problem hiding this comment.
Right. In this case, tsc doesn’t do anything additional. I simplified the script.
Collaborator
There was a problem hiding this comment.
Great thank you! Merging 👍 🚀
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Reference #15980
This PR is introducing TSTyche for type testing. Documentation: https://tstyche.org
For the beginning I only used the tool to check errors suppress by
// @ts-expect-error.The next possible step could be to test agains several TypeScript versions. For example,
tstyche --target '>=5.6'. I would recommend adding that for CI only.Since assertions are not touched, TS7 could be used in CI as well. TSTyche does not support TS7, because it does not have programmatic API yet.