Skip to content

Commit f7fb2ec

Browse files
authored
chore: update TSTyche to v5 (#15929)
1 parent 5258d53 commit f7fb2ec

File tree

10 files changed

+74
-74
lines changed

10 files changed

+74
-74
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: ts integration
4949
run: yarn test-ts --selectProjects ts-integration
5050
- name: type tests
51-
run: yarn test-types --target '>=5.4' # For documentation, see: https://tstyche.org/guide/typescript-versions
51+
run: yarn test-types --target '>=5.4' # For documentation, see: https://tstyche.org/guides/typescript-versions
5252
- name: verify TypeScript@5.4 compatibility
5353
run: yarn verify-old-ts
5454
- name: run ESLint with type info

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"strip-json-comments": "^3.1.1",
7979
"tempy": "^1.0.1",
8080
"ts-node": "^10.5.0",
81-
"tstyche": "^4.0.0",
81+
"tstyche": "^5.0.0",
8282
"typescript": "^5.8.3",
8383
"typescript-eslint": "^8.38.0",
8484
"webpack": "^5.68.0",

packages/expect/__typetests__/expect.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ describe('MatcherFunction', () => {
162162
};
163163
};
164164

165-
expect<ToBeWithinRange>().type.toBeAssignableWith(toBeWithinRange);
165+
expect<ToBeWithinRange>().type.toBeAssignableFrom(toBeWithinRange);
166166
});
167167

168168
test('requires the `actual` argument to be of type `unknown`', () => {
@@ -173,7 +173,7 @@ describe('MatcherFunction', () => {
173173
};
174174
};
175175

176-
expect<MatcherFunction>().type.not.toBeAssignableWith(actualMustBeUnknown);
176+
expect<MatcherFunction>().type.not.toBeAssignableFrom(actualMustBeUnknown);
177177
});
178178

179179
test('allows omitting the `expected` argument', () => {
@@ -193,7 +193,7 @@ describe('MatcherFunction', () => {
193193
};
194194
};
195195

196-
expect<AllowOmittingExpected>().type.toBeAssignableWith(
196+
expect<AllowOmittingExpected>().type.toBeAssignableFrom(
197197
allowOmittingExpected,
198198
);
199199
});
@@ -205,7 +205,7 @@ describe('MatcherFunction', () => {
205205
};
206206
};
207207

208-
expect<MatcherFunction>().type.not.toBeAssignableWith(lacksMessage);
208+
expect<MatcherFunction>().type.not.toBeAssignableFrom(lacksMessage);
209209
});
210210

211211
test('the `pass` property is required in the return type', () => {
@@ -215,7 +215,7 @@ describe('MatcherFunction', () => {
215215
};
216216
};
217217

218-
expect<MatcherFunction>().type.not.toBeAssignableWith(lacksPass);
218+
expect<MatcherFunction>().type.not.toBeAssignableFrom(lacksPass);
219219
});
220220

221221
test('context is defined inside a matcher function', () => {
@@ -283,7 +283,7 @@ describe('MatcherFunction', () => {
283283
};
284284
};
285285

286-
expect<CustomStateAndExpected>().type.toBeAssignableWith(
286+
expect<CustomStateAndExpected>().type.toBeAssignableFrom(
287287
customContextAndExpected,
288288
);
289289
});

packages/jest-mock/__typetests__/Mocked.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('Mocked', () => {
6666
return;
6767
});
6868

69-
expect(new SomeClass('sample')).type.toBeAssignableWith(mockSomeInstance);
69+
expect(new SomeClass('sample')).type.toBeAssignableFrom(mockSomeInstance);
7070
});
7171

7272
test('wraps a function type with type definitions of the Jest mock function', () => {
@@ -83,7 +83,7 @@ describe('Mocked', () => {
8383
(a: boolean, b?: number) => true,
8484
);
8585

86-
expect(someFunction).type.toBeAssignableWith(mockFunction);
86+
expect(someFunction).type.toBeAssignableFrom(mockFunction);
8787
});
8888

8989
test('wraps an async function type with type definitions of the Jest mock function', () => {
@@ -102,7 +102,7 @@ describe('Mocked', () => {
102102
(a: Array<boolean>) => Promise.resolve(true),
103103
);
104104

105-
expect(someAsyncFunction).type.toBeAssignableWith(mockAsyncFunction);
105+
expect(someAsyncFunction).type.toBeAssignableFrom(mockAsyncFunction);
106106
});
107107

108108
test('wraps a function object type with type definitions of the Jest mock function', () => {
@@ -144,7 +144,7 @@ describe('Mocked', () => {
144144
return;
145145
});
146146

147-
expect(someFunctionObject).type.toBeAssignableWith(mockFunctionObject);
147+
expect(someFunctionObject).type.toBeAssignableFrom(mockFunctionObject);
148148
});
149149

150150
test('wraps an object type with type definitions of the Jest mock function', () => {
@@ -253,16 +253,16 @@ describe('Mocked', () => {
253253
mockObject.someClassInstance.methodB.mockImplementation,
254254
).type.not.toBeCallableWith((a: number) => 123);
255255

256-
expect(someObject).type.toBeAssignableWith(mockObject);
256+
expect(someObject).type.toBeAssignableFrom(mockObject);
257257
});
258258

259259
test('wraps the global `console` object type with type definitions of the Jest mock function', () => {
260260
const mockConsole = console as Mocked<typeof console>;
261261

262-
expect(console.log).type.toBeAssignableWith(
262+
expect(console.log).type.toBeAssignableFrom(
263263
mockConsole.log.mockImplementation(() => {}),
264264
);
265-
expect<MockInstance<typeof console.log>>().type.toBeAssignableWith(
265+
expect<MockInstance<typeof console.log>>().type.toBeAssignableFrom(
266266
mockConsole.log.mockImplementation(() => {}),
267267
);
268268
});

packages/jest-mock/__typetests__/utility-types.test.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,29 +108,29 @@ type IndexObject = {
108108
};
109109

110110
test('ClassLike', () => {
111-
expect<ClassLike>().type.toBeAssignableWith(SomeClass);
111+
expect<ClassLike>().type.toBeAssignableFrom(SomeClass);
112112

113-
expect<ClassLike>().type.not.toBeAssignableWith(() => {});
114-
expect<ClassLike>().type.not.toBeAssignableWith(function abc() {
113+
expect<ClassLike>().type.not.toBeAssignableFrom(() => {});
114+
expect<ClassLike>().type.not.toBeAssignableFrom(function abc() {
115115
return;
116116
});
117-
expect<ClassLike>().type.not.toBeAssignableWith('abc');
118-
expect<ClassLike>().type.not.toBeAssignableWith(123);
119-
expect<ClassLike>().type.not.toBeAssignableWith(false);
120-
expect<ClassLike>().type.not.toBeAssignableWith(someObject);
117+
expect<ClassLike>().type.not.toBeAssignableFrom('abc');
118+
expect<ClassLike>().type.not.toBeAssignableFrom(123);
119+
expect<ClassLike>().type.not.toBeAssignableFrom(false);
120+
expect<ClassLike>().type.not.toBeAssignableFrom(someObject);
121121
});
122122

123123
test('FunctionLike', () => {
124-
expect<FunctionLike>().type.toBeAssignableWith(() => {});
125-
expect<FunctionLike>().type.toBeAssignableWith(function abc() {
124+
expect<FunctionLike>().type.toBeAssignableFrom(() => {});
125+
expect<FunctionLike>().type.toBeAssignableFrom(function abc() {
126126
return;
127127
});
128128

129-
expect<FunctionLike>().type.not.toBeAssignableWith('abc');
130-
expect<FunctionLike>().type.not.toBeAssignableWith(123);
131-
expect<FunctionLike>().type.not.toBeAssignableWith(false);
132-
expect<FunctionLike>().type.not.toBeAssignableWith(SomeClass);
133-
expect<FunctionLike>().type.not.toBeAssignableWith(someObject);
129+
expect<FunctionLike>().type.not.toBeAssignableFrom('abc');
130+
expect<FunctionLike>().type.not.toBeAssignableFrom(123);
131+
expect<FunctionLike>().type.not.toBeAssignableFrom(false);
132+
expect<FunctionLike>().type.not.toBeAssignableFrom(SomeClass);
133+
expect<FunctionLike>().type.not.toBeAssignableFrom(someObject);
134134
});
135135

136136
test('ConstructorKeys', () => {

packages/jest-resolve/__typetests__/resolver.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ import type {
1616

1717
// PackageJSON
1818

19-
expect<PackageJSON>().type.toBeAssignableWith({
19+
expect<PackageJSON>().type.toBeAssignableFrom({
2020
caption: 'test',
2121
count: 100,
2222
isTest: true,
2323
location: {name: 'test', start: [1, 2], valid: false, x: 10, y: 20},
2424
values: [0, 10, 20, {x: 1, y: 2}, true, 'test', ['a', 'b']],
2525
});
2626

27-
expect<PackageJSON>().type.not.toBeAssignableWith({
27+
expect<PackageJSON>().type.not.toBeAssignableFrom({
2828
filter: () => {},
2929
});
3030

@@ -33,15 +33,15 @@ expect<PackageJSON>().type.not.toBeAssignableWith({
3333
function customSyncResolver(path: string, options: ResolverOptions): string {
3434
return path;
3535
}
36-
expect<SyncResolver>().type.toBeAssignableWith(customSyncResolver);
36+
expect<SyncResolver>().type.toBeAssignableFrom(customSyncResolver);
3737

3838
async function customAsyncResolver(
3939
path: string,
4040
options: ResolverOptions,
4141
): Promise<string> {
4242
return path;
4343
}
44-
expect<AsyncResolver>().type.toBeAssignableWith(customAsyncResolver);
44+
expect<AsyncResolver>().type.toBeAssignableFrom(customAsyncResolver);
4545

4646
// AsyncResolver
4747

@@ -60,7 +60,7 @@ const asyncResolver: AsyncResolver = async (path, options) => {
6060
};
6161

6262
const notReturningAsyncResolver = async () => {};
63-
expect<AsyncResolver>().type.not.toBeAssignableWith(
63+
expect<AsyncResolver>().type.not.toBeAssignableFrom(
6464
notReturningAsyncResolver(),
6565
);
6666

@@ -81,14 +81,14 @@ const syncResolver: SyncResolver = (path, options) => {
8181
};
8282

8383
const notReturningSyncResolver = () => {};
84-
expect<SyncResolver>().type.not.toBeAssignableWith(notReturningSyncResolver());
84+
expect<SyncResolver>().type.not.toBeAssignableFrom(notReturningSyncResolver());
8585

8686
// JestResolver
8787

88-
expect<JestResolver>().type.toBeAssignableWith({async: asyncResolver});
89-
expect<JestResolver>().type.toBeAssignableWith({sync: syncResolver});
90-
expect<JestResolver>().type.toBeAssignableWith({
88+
expect<JestResolver>().type.toBeAssignableFrom({async: asyncResolver});
89+
expect<JestResolver>().type.toBeAssignableFrom({sync: syncResolver});
90+
expect<JestResolver>().type.toBeAssignableFrom({
9191
async: asyncResolver,
9292
sync: syncResolver,
9393
});
94-
expect<JestResolver>().type.not.toBeAssignableWith({});
94+
expect<JestResolver>().type.not.toBeAssignableFrom({});

packages/jest-snapshot/__typetests__/SnapshotResolver.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,65 +28,65 @@ const snapshotResolver: SnapshotResolver = {
2828

2929
// resolveSnapshotPath
3030

31-
expect<SnapshotResolver>().type.not.toBeAssignableWith({
31+
expect<SnapshotResolver>().type.not.toBeAssignableFrom({
3232
resolveSnapshotPath: (testPath: string, snapshotExtension: boolean) =>
3333
'snapshot/path',
3434
resolveTestPath: () => 'test/path',
3535
testPathForConsistencyCheck: 'test/path/example',
3636
});
3737

38-
expect<SnapshotResolver>().type.not.toBeAssignableWith({
38+
expect<SnapshotResolver>().type.not.toBeAssignableFrom({
3939
resolveSnapshotPath: (testPath: boolean) => 'snapshot/path',
4040
resolveTestPath: () => 'test/path',
4141
testPathForConsistencyCheck: 'test/path/example',
4242
});
4343

44-
expect<SnapshotResolver>().type.not.toBeAssignableWith({
44+
expect<SnapshotResolver>().type.not.toBeAssignableFrom({
4545
resolveSnapshotPath: () => true,
4646
resolveTestPath: () => 'test/path',
4747
testPathForConsistencyCheck: 'test/path/example',
4848
});
4949

50-
expect<SnapshotResolver>().type.not.toBeAssignableWith({
50+
expect<SnapshotResolver>().type.not.toBeAssignableFrom({
5151
resolveTestPath: () => 'test/path',
5252
testPathForConsistencyCheck: 'test/path/example',
5353
});
5454

5555
// resolveTestPath
5656

57-
expect<SnapshotResolver>().type.not.toBeAssignableWith({
57+
expect<SnapshotResolver>().type.not.toBeAssignableFrom({
5858
resolveSnapshotPath: () => 'snapshot/path',
5959
resolveTestPath: (snapshotPath: string, snapshotExtension: boolean) =>
6060
'test/path',
6161
testPathForConsistencyCheck: 'test/path/example',
6262
});
6363

64-
expect<SnapshotResolver>().type.not.toBeAssignableWith({
64+
expect<SnapshotResolver>().type.not.toBeAssignableFrom({
6565
resolveSnapshotPath: () => 'snapshot/path',
6666
resolveTestPath: (snapshotPath: boolean) => 'test/path',
6767
testPathForConsistencyCheck: 'test/path/example',
6868
});
6969

70-
expect<SnapshotResolver>().type.not.toBeAssignableWith({
70+
expect<SnapshotResolver>().type.not.toBeAssignableFrom({
7171
resolveSnapshotPath: () => 'snapshot/path',
7272
resolveTestPath: () => true,
7373
testPathForConsistencyCheck: 'test/path/example',
7474
});
7575

76-
expect<SnapshotResolver>().type.not.toBeAssignableWith({
76+
expect<SnapshotResolver>().type.not.toBeAssignableFrom({
7777
resolveSnapshotPath: () => 'snapshot/path',
7878
testPathForConsistencyCheck: 'test/path/example',
7979
});
8080

8181
// testPathForConsistencyCheck
8282

83-
expect<SnapshotResolver>().type.not.toBeAssignableWith({
83+
expect<SnapshotResolver>().type.not.toBeAssignableFrom({
8484
resolveSnapshotPath: () => 'snapshot/path',
8585
resolveTestPath: () => 'test/path',
8686
testPathForConsistencyCheck: true,
8787
});
8888

89-
expect<SnapshotResolver>().type.not.toBeAssignableWith({
89+
expect<SnapshotResolver>().type.not.toBeAssignableFrom({
9090
resolveSnapshotPath: () => 'snapshot/path',
9191
resolveTestPath: () => 'test/path',
9292
});

packages/jest-types/__typetests__/config.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const config: Config = {};
1212

1313
describe('Config', () => {
1414
test('coverageThreshold', () => {
15-
expect(config).type.toBeAssignableWith({
15+
expect(config).type.toBeAssignableFrom({
1616
coverageThreshold: {
1717
'./src/api/very-important-module.js': {
1818
branches: 100,
@@ -56,7 +56,7 @@ describe('Config', () => {
5656
'clearTimeout' as const,
5757
];
5858

59-
expect(config).type.toBeAssignableWith({
59+
expect(config).type.toBeAssignableFrom({
6060
fakeTimers: {
6161
advanceTimers: true,
6262
doNotFake,
@@ -66,48 +66,48 @@ describe('Config', () => {
6666
},
6767
});
6868

69-
expect(config).type.toBeAssignableWith({
69+
expect(config).type.toBeAssignableFrom({
7070
fakeTimers: {
7171
advanceTimers: 40,
7272
now: Date.now(),
7373
},
7474
});
7575

76-
expect(config).type.not.toBeAssignableWith({
76+
expect(config).type.not.toBeAssignableFrom({
7777
fakeTimers: {
7878
now: new Date(),
7979
},
8080
});
8181

82-
expect(config).type.toBeAssignableWith({
82+
expect(config).type.toBeAssignableFrom({
8383
fakeTimers: {
8484
enableGlobally: true,
8585
legacyFakeTimers: true as const,
8686
},
8787
});
8888

89-
expect(config).type.not.toBeAssignableWith({
89+
expect(config).type.not.toBeAssignableFrom({
9090
fakeTimers: {
9191
advanceTimers: true,
9292
legacyFakeTimers: true as const,
9393
},
9494
});
9595

96-
expect(config).type.not.toBeAssignableWith({
96+
expect(config).type.not.toBeAssignableFrom({
9797
fakeTimers: {
9898
doNotFake,
9999
legacyFakeTimers: true as const,
100100
},
101101
});
102102

103-
expect(config).type.not.toBeAssignableWith({
103+
expect(config).type.not.toBeAssignableFrom({
104104
fakeTimers: {
105105
legacyFakeTimers: true as const,
106106
now: 1_483_228_800_000,
107107
},
108108
});
109109

110-
expect(config).type.not.toBeAssignableWith({
110+
expect(config).type.not.toBeAssignableFrom({
111111
fakeTimers: {
112112
legacyFakeTimers: true as const,
113113
timerLimit: 1000,
@@ -116,7 +116,7 @@ describe('Config', () => {
116116
});
117117

118118
test('projects', () => {
119-
expect(config).type.toBeAssignableWith({
119+
expect(config).type.toBeAssignableFrom({
120120
projects: [
121121
// projects can be globs or objects
122122
'./src/**',

0 commit comments

Comments
 (0)