tstyche 3.3.1 → 3.5.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
  };
@@ -695,7 +695,13 @@ declare function addsPackageText(packageVersion: string, packagePath: string): S
695
695
 
696
696
  declare function describeNameText(name: string, indent?: number): ScribblerJsx.Element;
697
697
 
698
- declare function diagnosticText(diagnostic: Diagnostic): ScribblerJsx.Element;
698
+ interface CodeFrameOptions {
699
+ linesAbove?: number;
700
+ linesBelow?: number;
701
+ showBreadcrumbs?: boolean;
702
+ }
703
+
704
+ declare function diagnosticText(diagnostic: Diagnostic, codeFrameOptions?: CodeFrameOptions): ScribblerJsx.Element;
699
705
 
700
706
  declare function taskStatusText(status: TaskResultStatus, task: Task): ScribblerJsx.Element;
701
707
 
@@ -871,4 +877,4 @@ declare class WatchService {
871
877
  watch(cancellationToken: CancellationToken): AsyncIterable<Array<Task>>;
872
878
  }
873
879
 
874
- export { Assertion, BaseReporter, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, Config, ConfigDiagnosticText, type ConfigFileOptions, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, type DiagnosticsHandler, type EnvironmentOptions, type Event, EventEmitter, type EventHandler, ExitCodeHandler, ExpectResult, ExpectService, type FileWatchHandler, FileWatcher, type InputHandler, InputService, type ItemDefinition, Line, ListReporter, type MatchResult, OptionBrand, type OptionDefinition, OptionGroup, Options, OutputService, Path, type Plugin, PluginService, ProjectResult, ProjectService, type Reporter, type ReporterEvent, type ResolvedConfig, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, Runner, Scribbler, ScribblerJsx, type ScribblerOptions, Select, SelectDiagnosticText, type SelectHookContext, SetupReporter, SourceFile, Store, SummaryReporter, TargetResult, type TargetResultStatus, Task, TaskResult, type TaskResultStatus, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, type TypeChecker, Version, type WatchHandler, WatchReporter, WatchService, Watcher, type WatcherOptions, addsPackageText, defaultOptions, describeNameText, diagnosticText, environmentOptions, fileViewText, formattedText, helpText, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
880
+ export { Assertion, BaseReporter, CancellationHandler, CancellationReason, CancellationToken, Cli, type CodeFrameOptions, CollectService, Color, type CommandLineOptions, Config, ConfigDiagnosticText, type ConfigFileOptions, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, type DiagnosticsHandler, type EnvironmentOptions, type Event, EventEmitter, type EventHandler, ExitCodeHandler, ExpectResult, ExpectService, type FileWatchHandler, FileWatcher, type InputHandler, InputService, type ItemDefinition, Line, ListReporter, type MatchResult, OptionBrand, type OptionDefinition, OptionGroup, Options, OutputService, Path, type Plugin, PluginService, ProjectResult, ProjectService, type Reporter, type ReporterEvent, type ResolvedConfig, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, Runner, Scribbler, ScribblerJsx, type ScribblerOptions, Select, SelectDiagnosticText, type SelectHookContext, SetupReporter, SourceFile, Store, SummaryReporter, TargetResult, type TargetResultStatus, Task, TaskResult, type TaskResultStatus, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, type TypeChecker, Version, type WatchHandler, WatchReporter, WatchService, Watcher, type WatcherOptions, addsPackageText, defaultOptions, describeNameText, diagnosticText, environmentOptions, fileViewText, formattedText, helpText, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
package/build/tstyche.js CHANGED
@@ -1157,11 +1157,11 @@ class CommandLineParser {
1157
1157
  this.#onDiagnostics = onDiagnostics;
1158
1158
  this.#options = Options.for(OptionGroup.CommandLine);
1159
1159
  }
1160
- async #onExpectsValue(optionName, optionBrand) {
1160
+ #onExpectsValue(optionName, optionBrand) {
1161
1161
  const text = [
1162
1162
  ConfigDiagnosticText.expectsValue(optionName),
1163
- await ConfigDiagnosticText.usage(optionName, optionBrand),
1164
- ].flat();
1163
+ ...ConfigDiagnosticText.usage(optionName, optionBrand),
1164
+ ];
1165
1165
  this.#onDiagnostics(Diagnostic.error(text));
1166
1166
  }
1167
1167
  async parse(commandLineArgs) {
@@ -1215,7 +1215,7 @@ class CommandLineParser {
1215
1215
  index++;
1216
1216
  break;
1217
1217
  }
1218
- await this.#onExpectsValue(optionName, optionDefinition.brand);
1218
+ this.#onExpectsValue(optionName, optionDefinition.brand);
1219
1219
  break;
1220
1220
  case OptionBrand.String:
1221
1221
  if (optionValue !== "") {
@@ -1225,7 +1225,7 @@ class CommandLineParser {
1225
1225
  index++;
1226
1226
  break;
1227
1227
  }
1228
- await this.#onExpectsValue(optionName, optionDefinition.brand);
1228
+ this.#onExpectsValue(optionName, optionDefinition.brand);
1229
1229
  break;
1230
1230
  }
1231
1231
  return index;
@@ -2013,12 +2013,15 @@ function CodeLineText({ gutterWidth, lineNumber, lineNumberColor = Color.Gray, l
2013
2013
  function SquiggleLineText({ gutterWidth, indentWidth = 0, squiggleColor, squiggleWidth }) {
2014
2014
  return (jsx(Line, { children: [" ".repeat(gutterWidth), jsx(Text, { color: Color.Gray, children: " | " }), " ".repeat(indentWidth), jsx(Text, { color: squiggleColor, children: "~".repeat(squiggleWidth === 0 ? 1 : squiggleWidth) })] }));
2015
2015
  }
2016
- function CodeSpanText({ diagnosticCategory, diagnosticOrigin }) {
2016
+ function CodeFrameText({ diagnosticCategory, diagnosticOrigin, options }) {
2017
+ const linesAbove = options?.linesAbove ?? 2;
2018
+ const linesBelow = options?.linesBelow ?? 3;
2019
+ const showBreadcrumbs = options?.showBreadcrumbs ?? true;
2017
2020
  const lineMap = diagnosticOrigin.sourceFile.getLineStarts();
2018
2021
  const { character: firstMarkedLineCharacter, line: firstMarkedLine } = diagnosticOrigin.sourceFile.getLineAndCharacterOfPosition(diagnosticOrigin.start);
2019
2022
  const { character: lastMarkedLineCharacter, line: lastMarkedLine } = diagnosticOrigin.sourceFile.getLineAndCharacterOfPosition(diagnosticOrigin.end);
2020
- const firstLine = Math.max(firstMarkedLine - 2, 0);
2021
- const lastLine = Math.min(firstLine + 5, lineMap.length - 1);
2023
+ const firstLine = Math.max(firstMarkedLine - linesAbove, 0);
2024
+ const lastLine = Math.min(lastMarkedLine + linesBelow, lineMap.length - 1);
2022
2025
  const gutterWidth = (lastLine + 1).toString().length + 2;
2023
2026
  let highlightColor;
2024
2027
  switch (diagnosticCategory) {
@@ -2029,43 +2032,47 @@ function CodeSpanText({ diagnosticCategory, diagnosticOrigin }) {
2029
2032
  highlightColor = Color.Yellow;
2030
2033
  break;
2031
2034
  }
2032
- const codeSpan = [];
2035
+ const codeFrame = [];
2033
2036
  for (let index = firstLine; index <= lastLine; index++) {
2034
2037
  const lineStart = lineMap[index];
2035
2038
  const lineEnd = index === lineMap.length - 1 ? diagnosticOrigin.sourceFile.text.length : lineMap[index + 1];
2036
2039
  const lineText = diagnosticOrigin.sourceFile.text.slice(lineStart, lineEnd).trimEnd().replace(/\t/g, " ");
2037
2040
  if (index >= firstMarkedLine && index <= lastMarkedLine) {
2038
- codeSpan.push(jsx(CodeLineText, { gutterWidth: gutterWidth, lineNumber: index + 1, lineNumberColor: highlightColor, lineText: lineText }));
2041
+ codeFrame.push(jsx(CodeLineText, { gutterWidth: gutterWidth, lineNumber: index + 1, lineNumberColor: highlightColor, lineText: lineText }));
2039
2042
  if (index === firstMarkedLine) {
2040
2043
  const squiggleLength = index === lastMarkedLine
2041
2044
  ? lastMarkedLineCharacter - firstMarkedLineCharacter
2042
2045
  : lineText.length - firstMarkedLineCharacter;
2043
- codeSpan.push(jsx(SquiggleLineText, { gutterWidth: gutterWidth, indentWidth: firstMarkedLineCharacter, squiggleColor: highlightColor, squiggleWidth: squiggleLength }));
2046
+ codeFrame.push(jsx(SquiggleLineText, { gutterWidth: gutterWidth, indentWidth: firstMarkedLineCharacter, squiggleColor: highlightColor, squiggleWidth: squiggleLength }));
2044
2047
  }
2045
2048
  else if (index === lastMarkedLine) {
2046
- codeSpan.push(jsx(SquiggleLineText, { gutterWidth: gutterWidth, squiggleColor: highlightColor, squiggleWidth: lastMarkedLineCharacter }));
2049
+ codeFrame.push(jsx(SquiggleLineText, { gutterWidth: gutterWidth, squiggleColor: highlightColor, squiggleWidth: lastMarkedLineCharacter }));
2047
2050
  }
2048
2051
  else {
2049
- codeSpan.push(jsx(SquiggleLineText, { gutterWidth: gutterWidth, squiggleColor: highlightColor, squiggleWidth: lineText.length }));
2052
+ codeFrame.push(jsx(SquiggleLineText, { gutterWidth: gutterWidth, squiggleColor: highlightColor, squiggleWidth: lineText.length }));
2050
2053
  }
2051
2054
  }
2052
2055
  else {
2053
- codeSpan.push(jsx(CodeLineText, { gutterWidth: gutterWidth, lineNumber: index + 1, lineText: lineText }));
2056
+ codeFrame.push(jsx(CodeLineText, { gutterWidth: gutterWidth, lineNumber: index + 1, lineText: lineText }));
2054
2057
  }
2055
2058
  }
2056
- const location = (jsx(Line, { children: [" ".repeat(gutterWidth + 2), jsx(Text, { color: Color.Gray, children: " at " }), jsx(Text, { color: Color.Cyan, children: Path.relative("", diagnosticOrigin.sourceFile.fileName) }), jsx(Text, { color: Color.Gray, children: `:${firstMarkedLine + 1}:${firstMarkedLineCharacter + 1}` }), diagnosticOrigin.assertion && jsx(BreadcrumbsText, { ancestor: diagnosticOrigin.assertion.parent })] }));
2057
- return (jsx(Text, { children: [codeSpan, jsx(Line, {}), location] }));
2059
+ let breadcrumbs;
2060
+ if (showBreadcrumbs && diagnosticOrigin.assertion != null) {
2061
+ breadcrumbs = jsx(BreadcrumbsText, { ancestor: diagnosticOrigin.assertion.parent });
2062
+ }
2063
+ const location = (jsx(Line, { children: [" ".repeat(gutterWidth + 2), jsx(Text, { color: Color.Gray, children: " at " }), jsx(Text, { color: Color.Cyan, children: Path.relative("", diagnosticOrigin.sourceFile.fileName) }), jsx(Text, { color: Color.Gray, children: `:${firstMarkedLine + 1}:${firstMarkedLineCharacter + 1}` }), breadcrumbs] }));
2064
+ return (jsx(Text, { children: [codeFrame, jsx(Line, {}), location] }));
2058
2065
  }
2059
2066
 
2060
- function DiagnosticText({ diagnostic }) {
2067
+ function DiagnosticText({ codeFrameOptions, diagnostic }) {
2061
2068
  const code = diagnostic.code ? jsx(Text, { color: Color.Gray, children: [" ", diagnostic.code] }) : undefined;
2062
2069
  const text = Array.isArray(diagnostic.text) ? diagnostic.text : [diagnostic.text];
2063
2070
  const message = text.map((text, index) => (jsx(Text, { children: [index === 1 ? jsx(Line, {}) : undefined, jsx(Line, { children: [text, index === 0 ? code : undefined] })] })));
2064
2071
  const related = diagnostic.related?.map((relatedDiagnostic) => jsx(DiagnosticText, { diagnostic: relatedDiagnostic }));
2065
- const codeSpan = diagnostic.origin ? (jsx(Text, { children: [jsx(Line, {}), jsx(CodeSpanText, { diagnosticCategory: diagnostic.category, diagnosticOrigin: diagnostic.origin })] })) : undefined;
2066
- return (jsx(Text, { children: [message, codeSpan, jsx(Line, {}), jsx(Text, { indent: 2, children: related })] }));
2072
+ const codeFrame = diagnostic.origin ? (jsx(Text, { children: [jsx(Line, {}), jsx(CodeFrameText, { diagnosticCategory: diagnostic.category, diagnosticOrigin: diagnostic.origin, options: codeFrameOptions })] })) : undefined;
2073
+ return (jsx(Text, { children: [message, codeFrame, jsx(Line, {}), jsx(Text, { indent: 2, children: related })] }));
2067
2074
  }
2068
- function diagnosticText(diagnostic) {
2075
+ function diagnosticText(diagnostic, codeFrameOptions = {}) {
2069
2076
  let prefix;
2070
2077
  switch (diagnostic.category) {
2071
2078
  case DiagnosticCategory.Error:
@@ -2075,7 +2082,7 @@ function diagnosticText(diagnostic) {
2075
2082
  prefix = jsx(Text, { color: Color.Yellow, children: "Warning: " });
2076
2083
  break;
2077
2084
  }
2078
- return (jsx(Text, { children: [prefix, jsx(DiagnosticText, { diagnostic: diagnostic })] }));
2085
+ return (jsx(Text, { children: [prefix, jsx(DiagnosticText, { codeFrameOptions: codeFrameOptions, diagnostic: diagnostic })] }));
2079
2086
  }
2080
2087
 
2081
2088
  function FileNameText({ filePath }) {
@@ -2841,26 +2848,28 @@ class WatchService {
2841
2848
  cancellationToken.cancel(reason);
2842
2849
  debounce.resolveWith([]);
2843
2850
  };
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);
2851
+ if (!environmentOptions.noInteractive) {
2852
+ const onInput = (chunk) => {
2853
+ switch (chunk.toLowerCase()) {
2854
+ case "\u0003":
2855
+ case "\u0004":
2856
+ case "\u001B":
2857
+ case "q":
2858
+ case "x":
2859
+ onClose(CancellationReason.WatchClose);
2860
+ break;
2861
+ case "\u000D":
2862
+ case "\u0020":
2863
+ case "a":
2864
+ debounce.clearTimeout();
2865
+ if (this.#watchedTestFiles.size > 0) {
2866
+ debounce.resolveWith([...this.#watchedTestFiles.values()]);
2867
+ }
2868
+ break;
2869
+ }
2870
+ };
2871
+ this.#inputService = new InputService(onInput);
2872
+ }
2864
2873
  const onChangedFile = (filePath) => {
2865
2874
  debounce.refreshTimeout();
2866
2875
  let task = this.#watchedTestFiles.get(filePath);
@@ -3475,10 +3484,10 @@ class MatchWorker {
3475
3484
  }
3476
3485
  #checkIsRelatedTo(sourceNode, targetNode, relation) {
3477
3486
  const sourceType = relation === this.#typeChecker.relation.identity
3478
- ? this.#trySimplifyType(this.getType(sourceNode))
3487
+ ? this.#simplifyType(this.getType(sourceNode))
3479
3488
  : this.getType(sourceNode);
3480
3489
  const targetType = relation === this.#typeChecker.relation.identity
3481
- ? this.#trySimplifyType(this.getType(targetNode))
3490
+ ? this.#simplifyType(this.getType(targetNode))
3482
3491
  : this.getType(targetNode);
3483
3492
  return this.#typeChecker.isTypeRelatedTo(sourceType, targetType, relation);
3484
3493
  }
@@ -3509,7 +3518,7 @@ class MatchWorker {
3509
3518
  return this.#typeChecker.typeToString(type);
3510
3519
  }
3511
3520
  getType(node) {
3512
- return this.#compiler.isExpression(node) ? this.#getTypeOfNode(node) : this.#getTypeOfTypeNode(node);
3521
+ return this.#compiler.isTypeNode(node) ? this.#getTypeOfTypeNode(node) : this.#getTypeOfNode(node);
3513
3522
  }
3514
3523
  #getTypeOfNode(node) {
3515
3524
  let type = this.#typeCache.get(node);
@@ -3548,10 +3557,10 @@ class MatchWorker {
3548
3557
  }
3549
3558
  return DiagnosticOrigin.fromNode(enclosingNode, this.assertion);
3550
3559
  }
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))) {
3560
+ #simplifyType(type) {
3561
+ if (type.isUnionOrIntersection()) {
3562
+ const candidateType = this.#simplifyType(type.types[0]);
3563
+ if (type.types.every((type) => this.#typeChecker.isTypeRelatedTo(this.#simplifyType(type), candidateType, this.#typeChecker.relation.identity))) {
3555
3564
  return candidateType;
3556
3565
  }
3557
3566
  }
@@ -4334,11 +4343,15 @@ class TaskRunner {
4334
4343
  class Runner {
4335
4344
  #eventEmitter = new EventEmitter();
4336
4345
  #resolvedConfig;
4337
- static version = "3.3.1";
4346
+ static version = "3.5.0";
4338
4347
  constructor(resolvedConfig) {
4339
4348
  this.#resolvedConfig = resolvedConfig;
4340
4349
  }
4341
4350
  async #addReporters() {
4351
+ if (this.#resolvedConfig.watch && !environmentOptions.noInteractive) {
4352
+ const watchReporter = new WatchReporter(this.#resolvedConfig);
4353
+ this.#eventEmitter.addReporter(watchReporter);
4354
+ }
4342
4355
  for (const reporter of this.#resolvedConfig.reporters) {
4343
4356
  switch (reporter) {
4344
4357
  case "list": {
@@ -4358,10 +4371,6 @@ class Runner {
4358
4371
  }
4359
4372
  }
4360
4373
  }
4361
- if (this.#resolvedConfig.watch) {
4362
- const watchReporter = new WatchReporter(this.#resolvedConfig);
4363
- this.#eventEmitter.addReporter(watchReporter);
4364
- }
4365
4374
  }
4366
4375
  async run(testFiles, cancellationToken = new CancellationToken()) {
4367
4376
  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.5.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.6",
67
+ "@types/react": "19.0.6",
68
68
  "ajv": "8.17.1",
69
- "cspell": "8.17.1",
69
+ "cspell": "8.17.2",
70
70
  "magic-string": "0.30.17",
71
- "monocart-coverage-reports": "2.11.5",
71
+ "monocart-coverage-reports": "2.11.6",
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"