tstyche 2.0.0 → 2.1.1

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/README.md CHANGED
@@ -59,6 +59,7 @@ test("handles numbers", () => {
59
59
  Here is the list of all matchers:
60
60
 
61
61
  - `.toBe()`, `.toBeAssignableTo()`, `.toBeAssignableWith()`, `.toMatch()` compare types or types of expression,
62
+ - `.toAcceptProps()` checks types of JSX component's props,
62
63
  - `.toHaveProperty()` looks up keys on an object type,
63
64
  - `.toRaiseError()` captures the type error message or code,
64
65
  - `.toBeString()`, `.toBeNumber()`, `.toBeVoid()` and 9 more shorthand checks for primitive types.
package/build/index.d.cts CHANGED
@@ -59,6 +59,31 @@ interface Test {
59
59
  todo: (name: string, callback?: () => void | Promise<void>) => void;
60
60
  }
61
61
  interface Matchers {
62
+ /**
63
+ * Checks if the JSX component accepts props of the given type.
64
+ *
65
+ * @remarks
66
+ *
67
+ * This is a work in progress feature. Generic components are not yet supported.
68
+ */
69
+ toAcceptProps: {
70
+ /**
71
+ * Checks if the JSX component accepts props of the given type.
72
+ *
73
+ * @remarks
74
+ *
75
+ * This is a work in progress feature. Generic components are not yet supported.
76
+ */
77
+ <Target>(): void;
78
+ /**
79
+ * Checks if the JSX component accepts the given props.
80
+ *
81
+ * @remarks
82
+ *
83
+ * This is a work in progress feature. Generic components are not yet supported.
84
+ */
85
+ (target: unknown): void;
86
+ };
62
87
  /**
63
88
  * Checks if the source type is identical to the target type.
64
89
  */
package/build/index.d.ts CHANGED
@@ -59,6 +59,31 @@ interface Test {
59
59
  todo: (name: string, callback?: () => void | Promise<void>) => void;
60
60
  }
61
61
  interface Matchers {
62
+ /**
63
+ * Checks if the JSX component accepts props of the given type.
64
+ *
65
+ * @remarks
66
+ *
67
+ * This is a work in progress feature. Generic components are not yet supported.
68
+ */
69
+ toAcceptProps: {
70
+ /**
71
+ * Checks if the JSX component accepts props of the given type.
72
+ *
73
+ * @remarks
74
+ *
75
+ * This is a work in progress feature. Generic components are not yet supported.
76
+ */
77
+ <Target>(): void;
78
+ /**
79
+ * Checks if the JSX component accepts the given props.
80
+ *
81
+ * @remarks
82
+ *
83
+ * This is a work in progress feature. Generic components are not yet supported.
84
+ */
85
+ (target: unknown): void;
86
+ };
62
87
  /**
63
88
  * Checks if the source type is identical to the target type.
64
89
  */
@@ -1,52 +1,17 @@
1
1
  import type ts from 'typescript';
2
2
 
3
- declare class DiagnosticOrigin {
4
- breadcrumbs: Array<string> | undefined;
5
- end: number;
6
- sourceFile: ts.SourceFile;
7
- start: number;
8
- constructor(start: number, end: number, sourceFile: ts.SourceFile, breadcrumbs?: Array<string>);
9
- static fromJsonNode(node: ts.Node, sourceFile: ts.SourceFile, skipTrivia: (position: number, sourceFile: ts.SourceFile) => number): DiagnosticOrigin;
10
- static fromNode(node: ts.Node, breadcrumbs?: Array<string>): DiagnosticOrigin;
11
- }
12
-
13
- declare enum DiagnosticCategory {
14
- Error = "error",
15
- Warning = "warning"
16
- }
17
-
18
- declare class Diagnostic {
19
- category: DiagnosticCategory;
20
- code: string | undefined;
21
- related: Array<Diagnostic> | undefined;
22
- origin: DiagnosticOrigin | undefined;
23
- text: string | Array<string>;
24
- constructor(text: string | Array<string>, category: DiagnosticCategory, origin?: DiagnosticOrigin);
25
- add(options: {
26
- code?: string;
27
- origin?: DiagnosticOrigin;
28
- related?: Array<Diagnostic>;
29
- }): this;
30
- static error(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
31
- static fromDiagnostics(diagnostics: ReadonlyArray<ts.Diagnostic>, compiler: typeof ts): Array<Diagnostic>;
32
- static fromError(text: string | Array<string>, error: unknown): Diagnostic;
33
- static isTsDiagnosticWithLocation(diagnostic: ts.Diagnostic): diagnostic is ts.DiagnosticWithLocation;
34
- static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
35
- }
36
-
37
3
  declare enum CancellationReason {
38
4
  ConfigChange = "configChange",
39
5
  ConfigError = "configError",
40
- FailFast = "failFast"
6
+ FailFast = "failFast",
7
+ WatchClose = "watchClose"
41
8
  }
42
9
 
43
- type CancellationRequestedHandler = (reason: CancellationReason) => void;
44
10
  declare class CancellationToken {
45
11
  #private;
46
12
  get isCancellationRequested(): boolean;
47
13
  get reason(): CancellationReason | undefined;
48
14
  cancel(reason: CancellationReason): void;
49
- onCancellationRequested(handler: CancellationRequestedHandler): void;
50
15
  reset(): void;
51
16
  }
52
17
 
@@ -57,7 +22,6 @@ declare class StoreService {
57
22
  install(tag: string, cancellationToken?: CancellationToken): Promise<string | undefined>;
58
23
  load(tag: string, cancellationToken?: CancellationToken): Promise<typeof ts | undefined>;
59
24
  open(): Promise<void>;
60
- resolveTag(tag: string): Promise<string | undefined>;
61
25
  update(): Promise<void>;
62
26
  validateTag(tag: string): Promise<boolean | undefined>;
63
27
  }
@@ -98,6 +62,95 @@ declare class OptionDefinitionsMap {
98
62
  static for(optionGroup: OptionGroup): Map<string, OptionDefinition>;
99
63
  }
100
64
 
65
+ declare class TestTree {
66
+ diagnostics: Set<ts.Diagnostic>;
67
+ members: Array<TestMember | Assertion>;
68
+ sourceFile: ts.SourceFile;
69
+ constructor(diagnostics: Set<ts.Diagnostic>, sourceFile: ts.SourceFile);
70
+ get hasOnly(): boolean;
71
+ }
72
+
73
+ declare enum TestMemberBrand {
74
+ Describe = "describe",
75
+ Test = "test",
76
+ Expect = "expect"
77
+ }
78
+ declare enum TestMemberFlags {
79
+ None = 0,
80
+ Fail = 1,
81
+ Only = 2,
82
+ Skip = 4,
83
+ Todo = 8
84
+ }
85
+
86
+ declare class TestMember {
87
+ #private;
88
+ brand: TestMemberBrand;
89
+ diagnostics: Set<ts.Diagnostic>;
90
+ flags: TestMemberFlags;
91
+ members: Array<TestMember | Assertion>;
92
+ name: string;
93
+ node: ts.CallExpression;
94
+ parent: TestTree | TestMember;
95
+ constructor(compiler: typeof ts, brand: TestMemberBrand, node: ts.CallExpression, parent: TestTree | TestMember, flags: TestMemberFlags);
96
+ validate(): Array<Diagnostic>;
97
+ }
98
+
99
+ interface MatcherNode extends ts.CallExpression {
100
+ expression: ts.PropertyAccessExpression;
101
+ }
102
+ declare class Assertion extends TestMember {
103
+ isNot: boolean;
104
+ matcherNode: MatcherNode;
105
+ modifierNode: ts.PropertyAccessExpression;
106
+ notNode: ts.PropertyAccessExpression | undefined;
107
+ constructor(compiler: typeof ts, brand: TestMemberBrand, node: ts.CallExpression, parent: TestTree | TestMember, flags: TestMemberFlags, matcherNode: MatcherNode, modifierNode: ts.PropertyAccessExpression, notNode?: ts.PropertyAccessExpression);
108
+ get matcherName(): ts.MemberName;
109
+ get source(): ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode>;
110
+ get target(): ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode>;
111
+ }
112
+
113
+ declare class CollectService {
114
+ #private;
115
+ constructor(compiler: typeof ts);
116
+ createTestTree(sourceFile: ts.SourceFile, semanticDiagnostics?: Array<ts.Diagnostic>): TestTree;
117
+ }
118
+
119
+ declare class DiagnosticOrigin {
120
+ assertion: Assertion | undefined;
121
+ end: number;
122
+ sourceFile: ts.SourceFile;
123
+ start: number;
124
+ constructor(start: number, end: number, sourceFile: ts.SourceFile, assertion?: Assertion);
125
+ static fromAssertion(assertion: Assertion): DiagnosticOrigin;
126
+ static fromJsonNode(node: ts.Node, sourceFile: ts.SourceFile, skipTrivia: (position: number, sourceFile: ts.SourceFile) => number): DiagnosticOrigin;
127
+ static fromNode(node: ts.Node, assertion?: Assertion): DiagnosticOrigin;
128
+ }
129
+
130
+ declare enum DiagnosticCategory {
131
+ Error = "error",
132
+ Warning = "warning"
133
+ }
134
+
135
+ declare class Diagnostic {
136
+ #private;
137
+ category: DiagnosticCategory;
138
+ code: string | undefined;
139
+ origin: DiagnosticOrigin | undefined;
140
+ related: Array<Diagnostic> | undefined;
141
+ text: string | Array<string>;
142
+ constructor(text: string | Array<string>, category: DiagnosticCategory, origin?: DiagnosticOrigin);
143
+ add(options: {
144
+ code?: string | undefined;
145
+ related?: Array<Diagnostic> | undefined;
146
+ }): this;
147
+ static error(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
148
+ extendWith(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
149
+ static fromDiagnostics(diagnostics: Array<ts.Diagnostic>, compiler: typeof ts): Array<Diagnostic>;
150
+ static fromError(text: string | Array<string>, error: unknown): Diagnostic;
151
+ static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
152
+ }
153
+
101
154
  /**
102
155
  * Options passed through the command line.
103
156
  */
@@ -221,12 +274,12 @@ declare enum Color {
221
274
  Gray = "90"
222
275
  }
223
276
 
224
- type ScribblerNode = Array<ScribblerNode> | ScribblerJsx.Element | string | undefined;
277
+ type ScribblerNode = Array<ScribblerNode> | ScribblerJsx.Element | string | number | undefined;
225
278
  type FunctionComponent = (props: Record<string, unknown>) => ScribblerJsx.Element;
226
279
  declare namespace ScribblerJsx {
227
280
  interface Element {
228
281
  props: Record<string, unknown>;
229
- type: FunctionComponent | string;
282
+ type: FunctionComponent | number | string;
230
283
  }
231
284
  interface ElementChildrenAttribute {
232
285
  children: ScribblerNode;
@@ -280,61 +333,6 @@ declare class TestFile {
280
333
  constructor(identifier: string | URL, position?: number);
281
334
  }
282
335
 
283
- declare class TestTree {
284
- diagnostics: Set<ts.Diagnostic>;
285
- members: Array<TestMember | Assertion>;
286
- sourceFile: ts.SourceFile;
287
- constructor(diagnostics: Set<ts.Diagnostic>, sourceFile: ts.SourceFile);
288
- get hasOnly(): boolean;
289
- }
290
-
291
- declare enum TestMemberBrand {
292
- Describe = "describe",
293
- Test = "test",
294
- Expect = "expect"
295
- }
296
- declare enum TestMemberFlags {
297
- None = 0,
298
- Fail = 1,
299
- Only = 2,
300
- Skip = 4,
301
- Todo = 8
302
- }
303
-
304
- declare class TestMember {
305
- brand: TestMemberBrand;
306
- diagnostics: Set<ts.Diagnostic>;
307
- flags: TestMemberFlags;
308
- members: Array<TestMember | Assertion>;
309
- name: string;
310
- node: ts.CallExpression;
311
- parent: TestTree | TestMember;
312
- constructor(compiler: typeof ts, brand: TestMemberBrand, node: ts.CallExpression, parent: TestTree | TestMember, flags: TestMemberFlags);
313
- get ancestorNames(): Array<string>;
314
- validate(): Array<Diagnostic>;
315
- }
316
-
317
- interface MatcherNode extends ts.CallExpression {
318
- expression: ts.PropertyAccessExpression;
319
- }
320
- declare class Assertion extends TestMember {
321
- isNot: boolean;
322
- matcherNode: MatcherNode;
323
- modifierNode: ts.PropertyAccessExpression;
324
- notNode: ts.PropertyAccessExpression | undefined;
325
- constructor(compiler: typeof ts, brand: TestMemberBrand, node: ts.CallExpression, parent: TestTree | TestMember, flags: TestMemberFlags, matcherNode: MatcherNode, modifierNode: ts.PropertyAccessExpression, notNode?: ts.PropertyAccessExpression);
326
- get ancestorNames(): Array<string>;
327
- get matcherName(): ts.MemberName;
328
- get source(): ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode>;
329
- get target(): ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode>;
330
- }
331
-
332
- declare class CollectService {
333
- #private;
334
- constructor(compiler: typeof ts);
335
- createTestTree(sourceFile: ts.SourceFile, semanticDiagnostics?: Array<ts.Diagnostic>): TestTree;
336
- }
337
-
338
336
  declare class ResultTiming {
339
337
  end: number;
340
338
  start: number;
@@ -436,7 +434,7 @@ declare function formattedText(input: string | Array<string> | Record<string, un
436
434
  declare function helpText(optionDefinitions: Map<string, OptionDefinition>, tstycheVersion: string): ScribblerJsx.Element;
437
435
 
438
436
  interface WriteStream {
439
- write: (log: string) => void;
437
+ write: (chunk: string) => void;
440
438
  }
441
439
  interface OutputServiceOptions {
442
440
  noColor?: boolean;
@@ -448,9 +446,9 @@ declare class OutputService {
448
446
  constructor(options?: OutputServiceOptions);
449
447
  clearTerminal(): void;
450
448
  eraseLastLine(): void;
451
- writeError(body: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
452
- writeMessage(body: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
453
- writeWarning(body: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
449
+ writeError(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
450
+ writeMessage(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
451
+ writeWarning(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
454
452
  }
455
453
 
456
454
  declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
@@ -603,6 +601,8 @@ declare class EventEmitter {
603
601
  removeHandlers(): void;
604
602
  }
605
603
 
604
+ type ArgumentNode = ts.Expression | ts.TypeNode;
605
+ type DiagnosticsHandler = (diagnostics: Diagnostic | Array<Diagnostic>) => void;
606
606
  interface MatchResult {
607
607
  explain: () => Array<Diagnostic>;
608
608
  isMatch: boolean;
@@ -617,66 +617,116 @@ interface TypeChecker extends ts.TypeChecker {
617
617
  };
618
618
  }
619
619
 
620
+ declare class MatchWorker {
621
+ #private;
622
+ assertion: Assertion;
623
+ constructor(compiler: typeof ts, typeChecker: TypeChecker, assertion: Assertion);
624
+ checkIsAssignableTo(sourceNode: ArgumentNode, targetNode: ArgumentNode): boolean;
625
+ checkIsAssignableWith(sourceNode: ArgumentNode, targetNode: ArgumentNode): boolean;
626
+ checkIsIdenticalTo(sourceNode: ArgumentNode, targetNode: ArgumentNode): boolean;
627
+ checkIsSubtype(sourceNode: ArgumentNode, targetNode: ArgumentNode): boolean;
628
+ extendsObjectType(type: ts.Type): boolean;
629
+ getParameterType(signature: ts.Signature, index: number): ts.Type | undefined;
630
+ getSignatures(node: ArgumentNode): Array<ts.Signature>;
631
+ getTypeText(node: ArgumentNode): string;
632
+ getType(node: ArgumentNode): ts.Type;
633
+ isAnyOrNeverType(type: ts.Type): type is ts.StringLiteralType | ts.NumberLiteralType;
634
+ isStringOrNumberLiteralType(type: ts.Type): type is ts.StringLiteralType | ts.NumberLiteralType;
635
+ isObjectType(type: ts.Type): type is ts.ObjectType;
636
+ isUnionType(type: ts.Type): type is ts.UnionType;
637
+ isUniqueSymbolType(type: ts.Type): type is ts.UniqueESSymbolType;
638
+ resolveDiagnosticOrigin(symbol: ts.Symbol, enclosingNode: ts.Node): DiagnosticOrigin;
639
+ }
640
+
620
641
  declare class PrimitiveTypeMatcher {
621
642
  #private;
622
- typeChecker: TypeChecker;
623
- constructor(typeChecker: TypeChecker, targetTypeFlag: ts.TypeFlags);
624
- match(sourceType: ts.Type): MatchResult;
643
+ constructor(targetTypeFlag: ts.TypeFlags);
644
+ match(matchWorker: MatchWorker, sourceNode: ArgumentNode): MatchResult;
645
+ }
646
+
647
+ declare class ToAcceptProps {
648
+ #private;
649
+ constructor(compiler: typeof ts, typeChecker: TypeChecker);
650
+ match(matchWorker: MatchWorker, sourceNode: ArgumentNode, targetNode: ArgumentNode, onDiagnostics: DiagnosticsHandler): MatchResult | undefined;
651
+ }
652
+
653
+ declare class ExpectDiagnosticText {
654
+ static argumentOrTypeArgumentMustBeProvided(argumentNameText: string, typeArgumentNameText: string): string;
655
+ static argumentMustBe(argumentNameText: string, expectedText: string): string;
656
+ static argumentMustBeProvided(argumentNameText: string): string;
657
+ static componentAcceptsProps(isTypeNode: boolean): string;
658
+ static componentDoesNotAcceptProps(isTypeNode: boolean): string;
659
+ static matcherIsDeprecated(matcherNameText: string): Array<string>;
660
+ static matcherIsNotSupported(matcherNameText: string): string;
661
+ static overloadGaveTheFollowingError(index: number, count: number, signatureText: string): string;
662
+ static raisedTypeError(count?: number): string;
663
+ static typeArgumentMustBe(argumentNameText: string, expectedText: string): string;
664
+ static typeDidNotRaiseError(isTypeNode: boolean): string;
665
+ static typeDidNotRaiseMatchingError(isTypeNode: boolean): string;
666
+ static typeDoesNotHaveProperty(typeText: string, propertyNameText: string): string;
667
+ static typeDoesMatch(sourceTypeText: string, targetTypeText: string): string;
668
+ static typeDoesNotMatch(sourceTypeText: string, targetTypeText: string): string;
669
+ static typeHasProperty(typeText: string, propertyNameText: string): string;
670
+ static typeIs(typeText: string): string;
671
+ static typeIsAssignableTo(sourceTypeText: string, targetTypeText: string): string;
672
+ static typeIsAssignableWith(sourceTypeText: string, targetTypeText: string): string;
673
+ static typeIsIdenticalTo(sourceTypeText: string, targetTypeText: string): string;
674
+ static typeIsNotAssignableTo(sourceTypeText: string, targetTypeText: string): string;
675
+ static typeIsNotAssignableWith(sourceTypeText: string, targetTypeText: string): string;
676
+ static typeIsNotCompatibleWith(sourceTypeText: string, targetTypeText: string): string;
677
+ static typeIsNotIdenticalTo(sourceTypeText: string, targetTypeText: string): string;
678
+ static typeRaisedError(isTypeNode: boolean, count: number, targetCount: number): string;
679
+ static typeRaisedMatchingError(isTypeNode: boolean): string;
680
+ static typeRequiresProperty(typeText: string, propertyNameText: string): string;
681
+ static typesOfPropertyAreNotCompatible(propertyNameText: string): string;
625
682
  }
626
683
 
627
684
  declare abstract class RelationMatcherBase {
628
- abstract relation: Relation;
629
- abstract relationExplanationText: string;
630
- relationExplanationVerb: string;
631
- typeChecker: TypeChecker;
632
- constructor(typeChecker: TypeChecker);
633
- protected explain(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): Array<Diagnostic>;
634
- match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
685
+ abstract explainText(sourceTypeText: string, targetTypeText: string): string;
686
+ abstract explainNotText(sourceTypeText: string, targetTypeText: string): string;
687
+ protected explain(matchWorker: MatchWorker, sourceNode: ArgumentNode, targetNode: ArgumentNode): Diagnostic[];
688
+ abstract match(matchWorker: MatchWorker, sourceNode: ArgumentNode, targetNode: ArgumentNode): MatchResult;
635
689
  }
636
690
 
637
691
  declare class ToBe extends RelationMatcherBase {
638
- relation: Relation;
639
- relationExplanationText: string;
692
+ explainText: typeof ExpectDiagnosticText.typeIsIdenticalTo;
693
+ explainNotText: typeof ExpectDiagnosticText.typeIsNotIdenticalTo;
694
+ match(matchWorker: MatchWorker, sourceNode: ArgumentNode, targetNode: ArgumentNode): MatchResult;
640
695
  }
641
696
 
642
697
  declare class ToBeAssignableTo extends RelationMatcherBase {
643
- relation: Relation;
644
- relationExplanationText: string;
698
+ explainText: typeof ExpectDiagnosticText.typeIsAssignableTo;
699
+ explainNotText: typeof ExpectDiagnosticText.typeIsNotAssignableTo;
700
+ match(matchWorker: MatchWorker, sourceNode: ArgumentNode, targetNode: ArgumentNode): MatchResult;
645
701
  }
646
702
 
647
703
  declare class ToBeAssignableWith extends RelationMatcherBase {
648
- relation: Relation;
649
- relationExplanationText: string;
650
- match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
704
+ explainText: typeof ExpectDiagnosticText.typeIsAssignableWith;
705
+ explainNotText: typeof ExpectDiagnosticText.typeIsNotAssignableWith;
706
+ match(matchWorker: MatchWorker, sourceNode: ArgumentNode, targetNode: ArgumentNode): MatchResult;
651
707
  }
652
708
 
653
709
  declare class ToHaveProperty {
654
710
  #private;
655
- compiler: typeof ts;
656
- typeChecker: TypeChecker;
657
- constructor(compiler: typeof ts, typeChecker: TypeChecker);
658
- match(sourceType: ts.Type, targetType: ts.StringLiteralType | ts.NumberLiteralType | ts.UniqueESSymbolType, isNot: boolean): MatchResult;
711
+ constructor(compiler: typeof ts);
712
+ match(matchWorker: MatchWorker, sourceNode: ArgumentNode, targetNode: ArgumentNode, onDiagnostics: DiagnosticsHandler): MatchResult | undefined;
659
713
  }
660
714
 
661
715
  declare class ToMatch extends RelationMatcherBase {
662
- relation: Relation;
663
- relationExplanationText: string;
664
- relationExplanationVerb: string;
716
+ explainText: typeof ExpectDiagnosticText.typeDoesMatch;
717
+ explainNotText: typeof ExpectDiagnosticText.typeDoesNotMatch;
718
+ match(matchWorker: MatchWorker, sourceNode: ArgumentNode, targetNode: ArgumentNode): MatchResult;
665
719
  }
666
720
 
667
721
  declare class ToRaiseError {
668
722
  #private;
669
- compiler: typeof ts;
670
- typeChecker: TypeChecker;
671
- constructor(compiler: typeof ts, typeChecker: TypeChecker);
672
- match(source: {
673
- diagnostics: Array<ts.Diagnostic>;
674
- node: ts.Expression | ts.TypeNode;
675
- }, targetTypes: Array<ts.StringLiteralType | ts.NumberLiteralType>, isNot: boolean): MatchResult;
723
+ constructor(compiler: typeof ts);
724
+ match(matchWorker: MatchWorker, sourceNode: ArgumentNode, targetNodes: Array<ArgumentNode>, onDiagnostics: DiagnosticsHandler): MatchResult | undefined;
676
725
  }
677
726
 
678
- declare class Expect {
727
+ declare class ExpectService {
679
728
  #private;
729
+ toAcceptProps: ToAcceptProps;
680
730
  toBe: ToBe;
681
731
  toBeAny: PrimitiveTypeMatcher;
682
732
  toBeAssignable: ToBeAssignableWith;
@@ -699,7 +749,7 @@ declare class Expect {
699
749
  toRaiseError: ToRaiseError;
700
750
  constructor(compiler: typeof ts, typeChecker: TypeChecker);
701
751
  static assertTypeChecker(typeChecker: ts.TypeChecker): typeChecker is TypeChecker;
702
- match(assertion: Assertion, expectResult: ExpectResult): MatchResult | undefined;
752
+ match(assertion: Assertion, onDiagnostics: DiagnosticsHandler): MatchResult | undefined;
703
753
  }
704
754
 
705
755
  declare class CancellationHandler implements EventHandler {
@@ -791,7 +841,7 @@ declare class Version {
791
841
  static isVersionTag(target: string): boolean;
792
842
  }
793
843
 
794
- type WatchHandler = (filePath: string) => void | Promise<void>;
844
+ type WatchHandler = (filePath: string) => void;
795
845
  interface WatcherOptions {
796
846
  recursive?: boolean;
797
847
  }
@@ -799,20 +849,18 @@ declare class Watcher {
799
849
  #private;
800
850
  constructor(targetPath: string, onChanged: WatchHandler, onRemoved?: WatchHandler, options?: WatcherOptions);
801
851
  close(): void;
802
- watch(): Promise<void>;
852
+ watch(): void;
803
853
  }
804
854
 
805
- type FileWatchHandler = () => void | Promise<void>;
855
+ type FileWatchHandler = () => void;
806
856
  declare class FileWatcher extends Watcher {
807
857
  constructor(targetPath: string, onChanged: FileWatchHandler);
808
858
  }
809
859
 
810
- type RunCallback = (testFiles: Array<TestFile>) => Promise<void>;
811
860
  declare class WatchService {
812
861
  #private;
813
- constructor(resolvedConfig: ResolvedConfig, runCallback: RunCallback, selectService: SelectService, testFiles: Array<TestFile>);
814
- close(): void;
815
- watch(cancellationToken?: CancellationToken): Promise<Array<void>>;
862
+ constructor(resolvedConfig: ResolvedConfig, selectService: SelectService, testFiles: Array<TestFile>);
863
+ watch(cancellationToken: CancellationToken): AsyncIterable<Array<TestFile>>;
816
864
  }
817
865
 
818
- export { Assertion, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, ConfigDiagnosticText, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, ExitCodeHandler, Expect, ExpectResult, FileResult, type FileResultStatus, type FileWatchHandler, FileWatcher, type InputHandler, InputService, type InputServiceOptions, type ItemDefinition, Line, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, OutputService, type OutputServiceOptions, Path, ProjectResult, ProjectService, type ReadStream, type ResolvedConfig, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, type RunCallback, RunReporter, Scribbler, ScribblerJsx, type ScribblerOptions, SelectDiagnosticText, SelectService, SetupReporter, StoreService, SummaryReporter, TSTyche, TargetResult, type TargetResultStatus, TaskRunner, TestFile, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, type TypeChecker, Version, type WatchHandler, WatchReporter, WatchService, Watcher, type WatcherOptions, type WriteStream, addsPackageStepText, defaultOptions, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText, waitingForFileChangesText, watchUsageText };
866
+ export { Assertion, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, ConfigDiagnosticText, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, ExitCodeHandler, ExpectResult, ExpectService, FileResult, type FileResultStatus, type FileWatchHandler, FileWatcher, type InputHandler, InputService, type InputServiceOptions, type ItemDefinition, Line, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, OutputService, type OutputServiceOptions, Path, ProjectResult, ProjectService, type ReadStream, type ResolvedConfig, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, RunReporter, Scribbler, ScribblerJsx, type ScribblerOptions, SelectDiagnosticText, SelectService, SetupReporter, StoreService, SummaryReporter, TSTyche, TargetResult, type TargetResultStatus, TaskRunner, TestFile, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, type TypeChecker, Version, type WatchHandler, WatchReporter, WatchService, Watcher, type WatcherOptions, type WriteStream, addsPackageStepText, defaultOptions, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText, waitingForFileChangesText, watchUsageText };