test(types): use tstyche instead of tsd#1525
Closed
mrazauskas wants to merge 1 commit intosupabase:masterfrom
mrazauskas:use-tstyche
Closed
test(types): use tstyche instead of tsd#1525mrazauskas wants to merge 1 commit intosupabase:masterfrom mrazauskas:use-tstyche
tstyche instead of tsd#1525mrazauskas wants to merge 1 commit intosupabase:masterfrom
mrazauskas:use-tstyche
Conversation
mrazauskas
commented
Aug 8, 2025
| "test:node:playwright": "cd test/integration/node-browser && npm install && cp ../../../dist/umd/supabase.js . && npm run test", | ||
| "test:bun": "cd test/integration/bun && bun install && bun test", | ||
| "test:types": "run-s build:module && tsd --files test/types/*.test-d.ts && jsr publish --dry-run", | ||
| "test:types": "run-s build:module && tstyche && jsr publish --dry-run", |
Contributor
Author
There was a problem hiding this comment.
What if the jsr part would be move to a separate test:jsr script? This way test:types could be passed --target '>=4.7' in CI.
Member
|
Tstyche will be kept as a way to cross-test our typings for multiples TS version with the basic Once we're comfortable with it, we might migrate more of the codebase to it. Closing for now. |
Contributor
Author
|
Fine with me (; Thanks for feedback! |
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.
What kind of change does this PR introduce?
This PR migrates type test to TSTyche. Similar to supabase/postgrest-js#633
/cc @avallete
What is the new behavior?
This repo has only one test file, so I took an opportunity to demo TSTyche specific features:
test()helpers and assertions like.toBe(),.not.toBeCallableWith().In the PR of
supabase/postgrest-jsrepo, checks of// @ts-expect-errorare used. Which is a good idea, of course. Only that it makes testing agains many versions of TypeScript less smooth, because of changing message text.In a way the message text is only implementation detail. In this PR I used
.not.toBeCallableWith()which tries to call the given expression and passes if there is any error. (It also checks if the expression is actually callable.) This way testing can be done across several TypeScript versions.By the way, the actual calling of the expression is implemented via erased syntax:
roughly becomes:
Additional context
Current version of
tsdships and uses TypeScript 5.3.3. TSTyche is using the installed version of TypeScript which currently is 4.7.4.As suggested in the above mentioned PR, in CI it would be possible to run tests agains a range of TypeScript versions:
tstyche --target '>=4.7'. The exact range should be decided.Sorry, I can’t figure out how to update
deno.lock.