feat: improve expectTypeOf error messages#4206
Merged
Merged
Conversation
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.
Description
Update expect-type version to the prerelease from mmkal/expect-type#16 - it should make error messages much better. This is hard to see in a repo where the assertions are passing, but see the snapshot update in that PR. (Note: the title is "improve expectTypeOf error messages" rather than referencing the update, since that's the net effect for end-users).
Here are what the examples of failing-test.d.ts in this repo look like:
Before:
After:
Related to #1954 - @sheremet-va FYI. I don't think it closes it as that issue seems. to be more about how it fits into the vitest API/usage generally.
I also linked to my library in the readme.
I've opened this as a draft as I'd like to publish v0.17.0 (rather than under thenextdist-tag). I might actually bump to v1.0.0 too, I'm thinking of this as a release candidate (candidate).Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
expectTypeOf<any>().toBeBoolean()now produces an error, but I don't think that test needs to be duplicated here? I've checked this checkbox because I updated the error message snapshot tests.)- [ ] Please, don't make changes topnpm-lock.yamlunless you introduce a new test example. (err I needed to update it because I was updating a dependency? Should I delete this item?)Tests
pnpm test:ci(also updatedtest/typescript/test/runner.test.tsand related snapshots to reflect the new error messages)Note: test/coverage-test failed with the below error but I think it's unrelated? _Edit: Yep, I got the same error on main_
Also node.spec.ts and math.ts seemed to have a newline added to them for some reason. Not sure what that's about.
Documentation
pnpm run docscommand. (_I haven't added docs, but I wrote lots in the pull request on expect-type. Is there a way to copy them here automatically and keep them in sync? Should I copy paste?)Changesets
feat:,fix:,perf:,docs:, orchore:.