-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
25 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
import { enforce } from 'n4s'; | ||
import { DropFirst } from 'utilityTypes'; | ||
|
||
import { allOf } from 'allOf'; | ||
import { anyOf } from 'anyOf'; | ||
import { EnforceCustomMatcher } from 'enforceUtilityTypes'; | ||
import { Lazy } from 'genEnforceLazy'; | ||
import { noneOf } from 'noneOf'; | ||
import { oneOf } from 'oneOf'; | ||
import { RuleDetailedResult } from 'ruleReturn'; | ||
|
||
enforce.extend({ allOf, anyOf, noneOf, oneOf }); | ||
|
||
type EnforceCompoundRule = ( | ||
value: unknown, | ||
...rules: Lazy[] | ||
) => RuleDetailedResult; | ||
|
||
/* eslint-disable @typescript-eslint/no-namespace */ | ||
declare global { | ||
namespace n4s { | ||
interface EnforceCustomMatchers<R> { | ||
allOf: (...args: DropFirst<Parameters<typeof allOf>>) => R; | ||
anyOf: (...args: DropFirst<Parameters<typeof anyOf>>) => R; | ||
noneOf: (...args: DropFirst<Parameters<typeof noneOf>>) => R; | ||
oneOf: (...args: DropFirst<Parameters<typeof oneOf>>) => R; | ||
allOf: EnforceCustomMatcher<EnforceCompoundRule, R>; | ||
anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>; | ||
noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>; | ||
oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { CB, DropFirst } from 'utilityTypes'; | ||
|
||
export type EnforceCustomMatcher<F extends CB, R> = ( | ||
...args: DropFirst<Parameters<F>> | ||
) => R; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
147c906
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
vest-next – ./website
vest-website.vercel.app
vest-next-ealush.vercel.app
vest-next.vercel.app
vest-next-git-latest-ealush.vercel.app