-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Remove tsd in favor of tsc + test utilities #15951
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
|
cc @chriskrycho |
AbdelrahmanHafez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of minor questions, overall LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
hasezoey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, though some minor style questions.
tsd might not be able to keep working as-is when ts-go drops, as it ships its own typescript version and patches it. It also seems to practically be in maintenance mode (looking at tsdjs/tsd#224 not having a answer as of now).
Might it be worth to investigate switching to tstyche instead as that does not vendor typescript and only makes use of the typescript public API, which to my knowledge, they intend to keep working with ts-go?
Thanks for mentioning TSTyche! (I am its author.) Yes, TypeScript 7 support is in the plans. I will start working on this as soon as APIs will be available. Let me add some doubts regarding the following statement:
In my opinion, In contrary, TSTyche does even more. It is able to check errors suppressed by There are many other differences between compiler ( |
|
Just saw this! Will try to give it a gander in the next couple of days—thanks for the ping, and hooray for doing the work! |
hasezoey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looks good to me, though i still dont quite like that ExpectAssignable requires a extra function invocation.
Also personally, i would still recommend with going to something like tstyche (mostly due to the concerns listed in #15951 (comment)).
|
@mrazauskas I tried out tstyche, it is very cool. I like how you can assert on the error message with Couple of questions:
|
|
@vkarpov15 Thanks! Glad to hear that.
TSTyche uses TypeScript programmatically via language service API. This is the entry point used by IDEs and it is optimised to open / check a single file. Also the
expect(getPerson).type.not.toBeCallableWith({ name: false })
; (getPerson) ({ name: false }) Having an error means the expression is not callable. (The matcher also makes sure that the expression has call signatures.) Same with As you noticed, there are no generics in the matchers by design. Having any generics means the limitations of conditional types become limitations of the library.
You can configure this via the By the way,
In case if it feels better, you can use TSTyche as a runner and bring in your own generic based assertions. That works. I went with At some point I plan to add |
hasezoey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looks good to me, I dont quite know what i should be reviewing since my last review though.
|
@hasezoey that's my bad, I saw the "re-request review" icon on "Reviewers" so I just re-requested without reading your review comment, sorry
|

Summary
tsd is nice, but with the ts-go rewrite the future of tsd is uncertain. Either way, using TypeScript directly should be more accurate in terms of catching errors, and will hopefully allow us to test with multiple different TypeScript configs as well.
Examples