Skip to content

chore update TSTyche to v5#2172

Merged
jdeniau merged 2 commits intoimmutable-js:mainfrom
mrazauskas:update-tstyche
Jan 22, 2026
Merged

chore update TSTyche to v5#2172
jdeniau merged 2 commits intoimmutable-js:mainfrom
mrazauskas:update-tstyche

Conversation

@mrazauskas
Copy link
Contributor

Closes #2169

This PR updates TSTyche to v5.

TSTyche 4 release notes: https://tstyche.org/releases/tstyche-4
TSTyche 5 release notes: https://tstyche.org/releases/tstyche-5

Notable changes:

  • matcher .toBeAssignableWith() is renamed to .toBeAssignableFrom()
  • support for TypeScript 4.x is dropped

I think, these test cases look more consistent when .toBeAssignableTo() is used. Because the type under test stay on the left hand side in all assertions. Like Set([1, 'a']) in the following:

   expect(Set([1, 'a'])).type.toBe<Set<number | string>>();

-  expect<Set<number>>().type.not.toBeAssignableFrom(Set([1, 'a']));
+  expect(Set([1, 'a'])).type.not.toBeAssignableTo<Set<number>>();

This is sorted out. What about TypeScript version?


- name: 'Test types'
run: npm run test:types -- --target 4.5,5.0,current
run: npm run test:types -- --target '5.0 || *'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since TSTyche 5, the syntax of a range has changed. As you see, now it is similar to semver range.

@mrazauskas
Copy link
Contributor Author

mrazauskas commented Jan 10, 2026

@jdeniau By the way, the following (from #2014) is now passing:

expect<Map<string, string>>().type.not.toBe<OrderedMap<string, string>>();

Unless I missed something, .sort() was the only method added to Map. So both interfaces still should be identical. This was puzzling. I think the return type this & OrderedMap<K, V> is the culprit. Well.. intersections or not well handled by TypeScript’s internal .isTypeIdenticalTo() method (it is utilised to compare types by TSTyche 5 and below).

The good news: TSTyche 6 does not use this internal method anymore. Patching is required, but that would not work with TypeScript 7 anymore.

I try to say that this PR could also update TSTyche to 6.0. The tests are passing. All works. Only detail to think about: minimum supported TypeScript version would be 5.4 (it is two years old and this is the lowest versions Definitely Typed is currently testing agains).

@jdeniau
Copy link
Member

jdeniau commented Jan 11, 2026

I will check that PR soon.
About dropping TS 5.3, maybe do that in the 6.x branch then (which main purpose in to drop decades of old code and support).

@jdeniau jdeniau merged commit 2481a77 into immutable-js:main Jan 22, 2026
5 checks passed
@jdeniau
Copy link
Member

jdeniau commented Jan 22, 2026

thanks @mrazauskas !

I did merge that in main, and merged main in the 6.x branch, if you want to upgrade to tstyche 6.x

@mrazauskas mrazauskas deleted the update-tstyche branch February 2, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants