Comparing version 0.28.0 to 0.28.1
@@ -46,3 +46,3 @@ import { Predicate } from './predicates/predicate'; | ||
*/ | ||
isValid: <T>(value: T, predicate: BasePredicate<T>) => value is T; | ||
isValid: <T>(value: unknown, predicate: BasePredicate<T>) => value is T; | ||
/** | ||
@@ -65,4 +65,20 @@ Create a reusable validator. | ||
*/ | ||
(value: T, label?: string): void; | ||
(value: unknown | T, label?: string): void; | ||
} | ||
/** | ||
Turn a `ReusableValidator` into one with a type assertion. | ||
@example | ||
``` | ||
const checkUsername = ow.create(ow.string.minLength(3)); | ||
const checkUsername_: AssertingValidator<typeof checkUsername> = checkUsername; | ||
``` | ||
@example | ||
``` | ||
const predicate = ow.string.minLength(3); | ||
const checkUsername: AssertingValidator<typeof predicate> = ow.create(predicate); | ||
``` | ||
*/ | ||
export declare type AssertingValidator<T> = T extends ReusableValidator<infer R> ? (value: unknown, label?: string) => asserts value is R : T extends BasePredicate<infer R> ? (value: unknown, label?: string) => asserts value is R : never; | ||
declare const _ow: Ow; | ||
@@ -69,0 +85,0 @@ export default _ow; |
{ | ||
"name": "ow", | ||
"version": "0.28.0", | ||
"version": "0.28.1", | ||
"description": "Function argument validation for humans", | ||
@@ -52,3 +52,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@sindresorhus/is": "^4.0.1", | ||
"@sindresorhus/is": "^4.2.0", | ||
"callsites": "^3.1.0", | ||
@@ -63,3 +63,3 @@ "dot-prop": "^6.0.1", | ||
"@types/lodash.isequal": "^4.5.5", | ||
"@types/node": "^16.9.6", | ||
"@types/node": "^16.10.2", | ||
"@types/vali-date": "^1.0.0", | ||
@@ -71,4 +71,4 @@ "ava": "^2.4.0", | ||
"nyc": "^15.1.0", | ||
"ts-node": "^10.0.0", | ||
"typedoc": "^0.22.4", | ||
"ts-node": "^10.2.1", | ||
"typedoc": "^0.22.5", | ||
"typescript": "^4.4.3", | ||
@@ -75,0 +75,0 @@ "xo": "^0.38.2" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
136040
3317
Updated@sindresorhus/is@^4.2.0