Skip to content

Commit 2fc7d56

Browse files
committedJul 15, 2019
Change default Context type to unknown
1 parent 2451484 commit 2fc7d56

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed
 

‎index.d.ts

+23-23
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ export interface TruthyAssertion {
353353
}
354354

355355
/** The `t` value passed to test & hook implementations. */
356-
export interface ExecutionContext<Context = {}> extends Assertions {
356+
export interface ExecutionContext<Context = unknown> extends Assertions {
357357
/** Test context, shared with hooks. */
358358
context: Context;
359359

@@ -393,7 +393,7 @@ export interface TimeoutFn {
393393
}
394394

395395
/** The `t` value passed to implementations for tests & hooks declared with the `.cb` modifier. */
396-
export interface CbExecutionContext<Context = {}> extends ExecutionContext<Context> {
396+
export interface CbExecutionContext<Context = unknown> extends ExecutionContext<Context> {
397397
/**
398398
* End the test. If `error` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) the test or hook
399399
* will fail.
@@ -402,14 +402,14 @@ export interface CbExecutionContext<Context = {}> extends ExecutionContext<Conte
402402
}
403403

404404
export type ImplementationResult = PromiseLike<void> | ObservableLike | void;
405-
export type Implementation<Context = {}> = (t: ExecutionContext<Context>) => ImplementationResult;
406-
export type CbImplementation<Context = {}> = (t: CbExecutionContext<Context>) => ImplementationResult;
405+
export type Implementation<Context = unknown> = (t: ExecutionContext<Context>) => ImplementationResult;
406+
export type CbImplementation<Context = unknown> = (t: CbExecutionContext<Context>) => ImplementationResult;
407407

408408
/** A reusable test or hook implementation. */
409-
export type UntitledMacro<Args extends any[], Context = {}> = (t: ExecutionContext<Context>, ...args: Args) => ImplementationResult;
409+
export type UntitledMacro<Args extends any[], Context = unknown> = (t: ExecutionContext<Context>, ...args: Args) => ImplementationResult;
410410

411411
/** A reusable test or hook implementation. */
412-
export type Macro<Args extends any[], Context = {}> = UntitledMacro<Args, Context> & {
412+
export type Macro<Args extends any[], Context = unknown> = UntitledMacro<Args, Context> & {
413413
/**
414414
* Implement this function to generate a test (or hook) title whenever this macro is used. `providedTitle` contains
415415
* the title provided when the test or hook was declared. Also receives the remaining test arguments.
@@ -423,10 +423,10 @@ export type EitherMacro<Args extends any[], Context> = Macro<Args, Context> | Un
423423
export type OneOrMoreMacros<Args extends any[], Context> = EitherMacro<Args, Context> | [EitherMacro<Args, Context>, ...EitherMacro<Args, Context>[]];
424424

425425
/** A reusable test or hook implementation, for tests & hooks declared with the `.cb` modifier. */
426-
export type UntitledCbMacro<Args extends any[], Context = {}> = (t: CbExecutionContext<Context>, ...args: Args) => ImplementationResult
426+
export type UntitledCbMacro<Args extends any[], Context = unknown> = (t: CbExecutionContext<Context>, ...args: Args) => ImplementationResult
427427

428428
/** A reusable test or hook implementation, for tests & hooks declared with the `.cb` modifier. */
429-
export type CbMacro<Args extends any[], Context = {}> = UntitledCbMacro<Args, Context> & {
429+
export type CbMacro<Args extends any[], Context = unknown> = UntitledCbMacro<Args, Context> & {
430430
title?: (providedTitle: string | undefined, ...args: Args) => string;
431431
}
432432

@@ -435,7 +435,7 @@ export type EitherCbMacro<Args extends any[], Context> = CbMacro<Args, Context>
435435
/** Alias for a single macro, or an array of macros, used for tests & hooks declared with the `.cb` modifier. */
436436
export type OneOrMoreCbMacros<Args extends any[], Context> = EitherCbMacro<Args, Context> | [EitherCbMacro<Args, Context>, ...EitherCbMacro<Args, Context>[]];
437437

438-
export interface TestInterface<Context = {}> {
438+
export interface TestInterface<Context = unknown> {
439439
/** Declare a concurrent test. */
440440
(title: string, implementation: Implementation<Context>): void;
441441

@@ -472,7 +472,7 @@ export interface TestInterface<Context = {}> {
472472
meta: MetaInterface;
473473
}
474474

475-
export interface AfterInterface<Context = {}> {
475+
export interface AfterInterface<Context = unknown> {
476476
/** Declare a hook that is run once, after all tests have passed. */
477477
(implementation: Implementation<Context>): void;
478478

@@ -494,7 +494,7 @@ export interface AfterInterface<Context = {}> {
494494
skip: HookSkipInterface<Context>;
495495
}
496496

497-
export interface AlwaysInterface<Context = {}> {
497+
export interface AlwaysInterface<Context = unknown> {
498498
/** Declare a hook that is run once, after all tests are done. */
499499
(implementation: Implementation<Context>): void;
500500

@@ -513,7 +513,7 @@ export interface AlwaysInterface<Context = {}> {
513513
skip: HookSkipInterface<Context>;
514514
}
515515

516-
export interface BeforeInterface<Context = {}> {
516+
export interface BeforeInterface<Context = unknown> {
517517
/** Declare a hook that is run once, before all tests. */
518518
(implementation: Implementation<Context>): void;
519519

@@ -532,7 +532,7 @@ export interface BeforeInterface<Context = {}> {
532532
skip: HookSkipInterface<Context>;
533533
}
534534

535-
export interface CbInterface<Context = {}> {
535+
export interface CbInterface<Context = unknown> {
536536
/** Declare a test that must call `t.end()` when it's done. */
537537
(title: string, implementation: CbImplementation<Context>): void;
538538

@@ -555,7 +555,7 @@ export interface CbInterface<Context = {}> {
555555
skip: CbSkipInterface<Context>;
556556
}
557557

558-
export interface CbFailingInterface<Context = {}> {
558+
export interface CbFailingInterface<Context = unknown> {
559559
/** Declare a test that must call `t.end()` when it's done. The test is expected to fail. */
560560
(title: string, implementation: CbImplementation<Context>): void;
561561

@@ -575,7 +575,7 @@ export interface CbFailingInterface<Context = {}> {
575575
skip: CbSkipInterface<Context>;
576576
}
577577

578-
export interface CbOnlyInterface<Context = {}> {
578+
export interface CbOnlyInterface<Context = unknown> {
579579
/**
580580
* Declare a test that must call `t.end()` when it's done. Only this test and others declared with `.only()` are run.
581581
*/
@@ -594,7 +594,7 @@ export interface CbOnlyInterface<Context = {}> {
594594
<T extends any[]>(macros: OneOrMoreCbMacros<T, Context>, ...rest: T): void;
595595
}
596596

597-
export interface CbSkipInterface<Context = {}> {
597+
export interface CbSkipInterface<Context = unknown> {
598598
/** Skip this test. */
599599
(title: string, implementation: CbImplementation<Context>): void;
600600

@@ -605,7 +605,7 @@ export interface CbSkipInterface<Context = {}> {
605605
<T extends any[]>(macros: OneOrMoreCbMacros<T, Context>, ...rest: T): void;
606606
}
607607

608-
export interface FailingInterface<Context = {}> {
608+
export interface FailingInterface<Context = unknown> {
609609
/** Declare a concurrent test. The test is expected to fail. */
610610
(title: string, implementation: Implementation<Context>): void;
611611

@@ -625,7 +625,7 @@ export interface FailingInterface<Context = {}> {
625625
skip: SkipInterface<Context>;
626626
}
627627

628-
export interface HookCbInterface<Context = {}> {
628+
export interface HookCbInterface<Context = unknown> {
629629
/** Declare a hook that must call `t.end()` when it's done. */
630630
(implementation: CbImplementation<Context>): void;
631631

@@ -646,7 +646,7 @@ export interface HookCbInterface<Context = {}> {
646646
skip: HookCbSkipInterface<Context>;
647647
}
648648

649-
export interface HookCbSkipInterface<Context = {}> {
649+
export interface HookCbSkipInterface<Context = unknown> {
650650
/** Skip this hook. */
651651
(implementation: CbImplementation<Context>): void;
652652

@@ -660,7 +660,7 @@ export interface HookCbSkipInterface<Context = {}> {
660660
<T extends any[]>(macros: OneOrMoreCbMacros<T, Context>, ...rest: T): void;
661661
}
662662

663-
export interface HookSkipInterface<Context = {}> {
663+
export interface HookSkipInterface<Context = unknown> {
664664
/** Skip this hook. */
665665
(implementation: Implementation<Context>): void;
666666

@@ -674,7 +674,7 @@ export interface HookSkipInterface<Context = {}> {
674674
<T extends any[]>(macros: OneOrMoreMacros<T, Context>, ...rest: T): void;
675675
}
676676

677-
export interface OnlyInterface<Context = {}> {
677+
export interface OnlyInterface<Context = unknown> {
678678
/** Declare a test. Only this test and others declared with `.only()` are run. */
679679
(title: string, implementation: Implementation<Context>): void;
680680

@@ -691,7 +691,7 @@ export interface OnlyInterface<Context = {}> {
691691
<T extends any[]>(macros: OneOrMoreMacros<T, Context>, ...rest: T): void;
692692
}
693693

694-
export interface SerialInterface<Context = {}> {
694+
export interface SerialInterface<Context = unknown> {
695695
/** Declare a serial test. */
696696
(title: string, implementation: Implementation<Context>): void;
697697

@@ -726,7 +726,7 @@ export interface SerialInterface<Context = {}> {
726726
todo: TodoDeclaration;
727727
}
728728

729-
export interface SkipInterface<Context = {}> {
729+
export interface SkipInterface<Context = unknown> {
730730
/** Skip this test. */
731731
(title: string, implementation: Implementation<Context>): void;
732732

0 commit comments

Comments
 (0)
Please sign in to comment.