tstyche 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.cts CHANGED
@@ -216,26 +216,26 @@ interface Expect {
216
216
  /**
217
217
  * Builds an assertion.
218
218
  *
219
- * @template Source - The type against which the assertion will be made.
219
+ * @template Source - The type against which the assertion is made.
220
220
  */
221
221
  <Source>(): Modifier;
222
222
  /**
223
223
  * Builds an assertion.
224
224
  *
225
- * @param source - The expression against which type the assertion will be made.
225
+ * @param source - The expression against which type the assertion is made.
226
226
  */
227
227
  (source: unknown): Modifier;
228
228
  fail: {
229
229
  /**
230
230
  * Mark an assertion as supposed to fail.
231
231
  *
232
- * @template Source - The type against which the assertion will be made.
232
+ * @template Source - The type against which the assertion is made.
233
233
  */
234
234
  <Source>(): Modifier;
235
235
  /**
236
236
  * Mark an assertion as supposed to fail.
237
237
  *
238
- * @param source - The expression against which type the assertion will be made.
238
+ * @param source - The expression against which type the assertion is made.
239
239
  */
240
240
  (source: unknown): Modifier;
241
241
  };
@@ -246,26 +246,26 @@ interface Expect {
246
246
  /**
247
247
  * Marks an assertion as focused.
248
248
  *
249
- * @template Source - The type against which the assertion will be made.
249
+ * @template Source - The type against which the assertion is made.
250
250
  */
251
251
  <Source>(): Modifier;
252
252
  /**
253
253
  * Marks an assertion as focused.
254
254
  *
255
- * @param source - The expression against which type the assertion will be made.
255
+ * @param source - The expression against which type the assertion is made.
256
256
  */
257
257
  (source: unknown): Modifier;
258
258
  fail: {
259
259
  /**
260
260
  * Mark an assertion as supposed to fail.
261
261
  *
262
- * @template Source - The type against which the assertion will be made.
262
+ * @template Source - The type against which the assertion is made.
263
263
  */
264
264
  <Source>(): Modifier;
265
265
  /**
266
266
  * Mark an assertion as supposed to fail.
267
267
  *
268
- * @param source - The expression against which type the assertion will be made.
268
+ * @param source - The expression against which type the assertion is made.
269
269
  */
270
270
  (source: unknown): Modifier;
271
271
  };
@@ -277,26 +277,26 @@ interface Expect {
277
277
  /**
278
278
  * Marks an assertion as skipped.
279
279
  *
280
- * @template Source - The type against which the assertion will be made.
280
+ * @template Source - The type against which the assertion is made.
281
281
  */
282
282
  <Source>(): Modifier;
283
283
  /**
284
284
  * Marks an assertion as skipped.
285
285
  *
286
- * @param source - The expression against which type the assertion will be made.
286
+ * @param source - The expression against which type the assertion is made.
287
287
  */
288
288
  (source: unknown): Modifier;
289
289
  fail: {
290
290
  /**
291
291
  * Marks an assertion as supposed to fail.
292
292
  *
293
- * @template Source - The type against which the assertion will be made.
293
+ * @template Source - The type against which the assertion is made.
294
294
  */
295
295
  <Source>(): Modifier;
296
296
  /**
297
297
  * Marks an assertion as supposed to fail.
298
298
  *
299
- * @param source - The expression against which type the assertion will be made.
299
+ * @param source - The expression against which type the assertion is made.
300
300
  */
301
301
  (source: unknown): Modifier;
302
302
  };
package/build/index.d.ts CHANGED
@@ -216,26 +216,26 @@ interface Expect {
216
216
  /**
217
217
  * Builds an assertion.
218
218
  *
219
- * @template Source - The type against which the assertion will be made.
219
+ * @template Source - The type against which the assertion is made.
220
220
  */
221
221
  <Source>(): Modifier;
222
222
  /**
223
223
  * Builds an assertion.
224
224
  *
225
- * @param source - The expression against which type the assertion will be made.
225
+ * @param source - The expression against which type the assertion is made.
226
226
  */
227
227
  (source: unknown): Modifier;
228
228
  fail: {
229
229
  /**
230
230
  * Mark an assertion as supposed to fail.
231
231
  *
232
- * @template Source - The type against which the assertion will be made.
232
+ * @template Source - The type against which the assertion is made.
233
233
  */
234
234
  <Source>(): Modifier;
235
235
  /**
236
236
  * Mark an assertion as supposed to fail.
237
237
  *
238
- * @param source - The expression against which type the assertion will be made.
238
+ * @param source - The expression against which type the assertion is made.
239
239
  */
240
240
  (source: unknown): Modifier;
241
241
  };
@@ -246,26 +246,26 @@ interface Expect {
246
246
  /**
247
247
  * Marks an assertion as focused.
248
248
  *
249
- * @template Source - The type against which the assertion will be made.
249
+ * @template Source - The type against which the assertion is made.
250
250
  */
251
251
  <Source>(): Modifier;
252
252
  /**
253
253
  * Marks an assertion as focused.
254
254
  *
255
- * @param source - The expression against which type the assertion will be made.
255
+ * @param source - The expression against which type the assertion is made.
256
256
  */
257
257
  (source: unknown): Modifier;
258
258
  fail: {
259
259
  /**
260
260
  * Mark an assertion as supposed to fail.
261
261
  *
262
- * @template Source - The type against which the assertion will be made.
262
+ * @template Source - The type against which the assertion is made.
263
263
  */
264
264
  <Source>(): Modifier;
265
265
  /**
266
266
  * Mark an assertion as supposed to fail.
267
267
  *
268
- * @param source - The expression against which type the assertion will be made.
268
+ * @param source - The expression against which type the assertion is made.
269
269
  */
270
270
  (source: unknown): Modifier;
271
271
  };
@@ -277,26 +277,26 @@ interface Expect {
277
277
  /**
278
278
  * Marks an assertion as skipped.
279
279
  *
280
- * @template Source - The type against which the assertion will be made.
280
+ * @template Source - The type against which the assertion is made.
281
281
  */
282
282
  <Source>(): Modifier;
283
283
  /**
284
284
  * Marks an assertion as skipped.
285
285
  *
286
- * @param source - The expression against which type the assertion will be made.
286
+ * @param source - The expression against which type the assertion is made.
287
287
  */
288
288
  (source: unknown): Modifier;
289
289
  fail: {
290
290
  /**
291
291
  * Marks an assertion as supposed to fail.
292
292
  *
293
- * @template Source - The type against which the assertion will be made.
293
+ * @template Source - The type against which the assertion is made.
294
294
  */
295
295
  <Source>(): Modifier;
296
296
  /**
297
297
  * Marks an assertion as supposed to fail.
298
298
  *
299
- * @param source - The expression against which type the assertion will be made.
299
+ * @param source - The expression against which type the assertion is made.
300
300
  */
301
301
  (source: unknown): Modifier;
302
302
  };
package/build/tstyche.js CHANGED
@@ -2841,26 +2841,28 @@ class WatchService {
2841
2841
  cancellationToken.cancel(reason);
2842
2842
  debounce.resolveWith([]);
2843
2843
  };
2844
- const onInput = (chunk) => {
2845
- switch (chunk.toLowerCase()) {
2846
- case "\u0003":
2847
- case "\u0004":
2848
- case "\u001B":
2849
- case "q":
2850
- case "x":
2851
- onClose(CancellationReason.WatchClose);
2852
- break;
2853
- case "\u000D":
2854
- case "\u0020":
2855
- case "a":
2856
- debounce.clearTimeout();
2857
- if (this.#watchedTestFiles.size > 0) {
2858
- debounce.resolveWith([...this.#watchedTestFiles.values()]);
2859
- }
2860
- break;
2861
- }
2862
- };
2863
- this.#inputService = new InputService(onInput);
2844
+ if (!environmentOptions.noInteractive) {
2845
+ const onInput = (chunk) => {
2846
+ switch (chunk.toLowerCase()) {
2847
+ case "\u0003":
2848
+ case "\u0004":
2849
+ case "\u001B":
2850
+ case "q":
2851
+ case "x":
2852
+ onClose(CancellationReason.WatchClose);
2853
+ break;
2854
+ case "\u000D":
2855
+ case "\u0020":
2856
+ case "a":
2857
+ debounce.clearTimeout();
2858
+ if (this.#watchedTestFiles.size > 0) {
2859
+ debounce.resolveWith([...this.#watchedTestFiles.values()]);
2860
+ }
2861
+ break;
2862
+ }
2863
+ };
2864
+ this.#inputService = new InputService(onInput);
2865
+ }
2864
2866
  const onChangedFile = (filePath) => {
2865
2867
  debounce.refreshTimeout();
2866
2868
  let task = this.#watchedTestFiles.get(filePath);
@@ -3475,10 +3477,10 @@ class MatchWorker {
3475
3477
  }
3476
3478
  #checkIsRelatedTo(sourceNode, targetNode, relation) {
3477
3479
  const sourceType = relation === this.#typeChecker.relation.identity
3478
- ? this.#trySimplifyType(this.getType(sourceNode))
3480
+ ? this.#simplifyType(this.getType(sourceNode))
3479
3481
  : this.getType(sourceNode);
3480
3482
  const targetType = relation === this.#typeChecker.relation.identity
3481
- ? this.#trySimplifyType(this.getType(targetNode))
3483
+ ? this.#simplifyType(this.getType(targetNode))
3482
3484
  : this.getType(targetNode);
3483
3485
  return this.#typeChecker.isTypeRelatedTo(sourceType, targetType, relation);
3484
3486
  }
@@ -3509,7 +3511,7 @@ class MatchWorker {
3509
3511
  return this.#typeChecker.typeToString(type);
3510
3512
  }
3511
3513
  getType(node) {
3512
- return this.#compiler.isExpression(node) ? this.#getTypeOfNode(node) : this.#getTypeOfTypeNode(node);
3514
+ return this.#compiler.isTypeNode(node) ? this.#getTypeOfTypeNode(node) : this.#getTypeOfNode(node);
3513
3515
  }
3514
3516
  #getTypeOfNode(node) {
3515
3517
  let type = this.#typeCache.get(node);
@@ -3548,10 +3550,10 @@ class MatchWorker {
3548
3550
  }
3549
3551
  return DiagnosticOrigin.fromNode(enclosingNode, this.assertion);
3550
3552
  }
3551
- #trySimplifyType(type) {
3552
- if (type.isIntersection() || type.isUnion()) {
3553
- const candidateType = type.types[0];
3554
- if (type.types.every((type) => this.#typeChecker.isTypeRelatedTo(type, candidateType, this.#typeChecker.relation.identity))) {
3553
+ #simplifyType(type) {
3554
+ if (type.isUnionOrIntersection()) {
3555
+ const candidateType = this.#simplifyType(type.types[0]);
3556
+ if (type.types.every((type) => this.#typeChecker.isTypeRelatedTo(this.#simplifyType(type), candidateType, this.#typeChecker.relation.identity))) {
3555
3557
  return candidateType;
3556
3558
  }
3557
3559
  }
@@ -4334,11 +4336,15 @@ class TaskRunner {
4334
4336
  class Runner {
4335
4337
  #eventEmitter = new EventEmitter();
4336
4338
  #resolvedConfig;
4337
- static version = "3.3.1";
4339
+ static version = "3.4.0";
4338
4340
  constructor(resolvedConfig) {
4339
4341
  this.#resolvedConfig = resolvedConfig;
4340
4342
  }
4341
4343
  async #addReporters() {
4344
+ if (this.#resolvedConfig.watch && !environmentOptions.noInteractive) {
4345
+ const watchReporter = new WatchReporter(this.#resolvedConfig);
4346
+ this.#eventEmitter.addReporter(watchReporter);
4347
+ }
4342
4348
  for (const reporter of this.#resolvedConfig.reporters) {
4343
4349
  switch (reporter) {
4344
4350
  case "list": {
@@ -4358,10 +4364,6 @@ class Runner {
4358
4364
  }
4359
4365
  }
4360
4366
  }
4361
- if (this.#resolvedConfig.watch) {
4362
- const watchReporter = new WatchReporter(this.#resolvedConfig);
4363
- this.#eventEmitter.addReporter(watchReporter);
4364
- }
4365
4367
  }
4366
4368
  async run(testFiles, cancellationToken = new CancellationToken()) {
4367
4369
  const tasks = testFiles.map((testFile) => (testFile instanceof Task ? testFile : new Task(testFile)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tstyche",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
4
4
  "description": "The Essential Type Testing Tool.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -63,17 +63,17 @@
63
63
  "devDependencies": {
64
64
  "@biomejs/biome": "1.9.4",
65
65
  "@rollup/plugin-typescript": "12.1.2",
66
- "@types/node": "22.10.2",
67
- "@types/react": "19.0.2",
66
+ "@types/node": "22.10.5",
67
+ "@types/react": "19.0.4",
68
68
  "ajv": "8.17.1",
69
69
  "cspell": "8.17.1",
70
70
  "magic-string": "0.30.17",
71
71
  "monocart-coverage-reports": "2.11.5",
72
72
  "pretty-ansi": "3.0.0",
73
- "rollup": "4.29.1",
73
+ "rollup": "4.30.1",
74
74
  "rollup-plugin-dts": "6.1.1",
75
75
  "tslib": "2.8.1",
76
- "typescript": "5.7.2"
76
+ "typescript": "5.7.3"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "typescript": "4.x || 5.x"