Skip to content

Commit

Permalink
types(n4s): Allow adding types for custom matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Nov 10, 2021
1 parent 9275707 commit 780c5b7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/n4s/src/runtime/runtimeRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@ function getRule(ruleName: string): TRuleBase {
return baseRules[ruleName as KBaseRules];
}

/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-empty-interface */

declare global {
namespace n4s {
interface EnforceCustomMatchers<R> {}
}
}

export { baseRules, getRule };

export type TRules<E = Record<string, unknown>> = Record<
string,
(...args: TArgs) => TRules & E
export type TRules<E = Record<string, unknown>> = n4s.EnforceCustomMatchers<
TRules & E
> &
Record<string, (...args: TArgs) => TRules & E> &
{
[P in KCompounds]: (
...args: DropFirst<Parameters<TCompounds[P]>> | TArgs
Expand Down

0 comments on commit 780c5b7

Please sign in to comment.