File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,14 @@ export {
2020} ;
2121
2222/**
23- * Extends `@assertive-ts/core` with a local or 3rd-party plugin.
23+ * Extends `@assertive-ts/core` with local or 3rd-party plugin(s) .
2424 *
25- * @param plugin the plugin to use to extend assertive-ts
25+ * @param plugins a plugin or an array of plugins to use
2626 * @see {@link Plugin Plugin }
2727 */
28- export function usePlugin < T , A extends Assertion < T > > ( plugin : Plugin < T , A > ) : void {
29- config . addPlugin ( plugin ) ;
28+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29+ export function usePlugin < P extends Plugin < any , Assertion < any > > > ( plugins : P | P [ ] ) : void {
30+ Array . isArray ( plugins )
31+ ? plugins . forEach ( plugin => config . addPlugin ( plugin ) )
32+ : config . addPlugin ( plugins ) ;
3033}
Original file line number Diff line number Diff line change 11import { Assertion } from "../Assertion" ;
22
3+ /**
4+ * A plugin object that can be used to extend the `expect(..)` function.
5+ *
6+ * @param T the type the plugin is meant for
7+ * @param A the type of the assertion for `T`
8+ */
39export interface Plugin < T , A extends Assertion < T > > {
410 /**
5- * The `Assertion<T>` instance the plugin adds
11+ * The assertion `A` constructor the plugin adds
612 */
713 Assertion : new ( actual : T ) => A ;
814 /**
You can’t perform that action at this time.
0 commit comments