You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test if the value matches the predicate. Throws an `ArgumentError` if the test fails.
@param value - Value to test.
@param predicate - Predicate to test against.
*/
<T>(value: unknown,predicate: BasePredicate<T>): asserts value is T;
/**
Test if `value` matches the provided `predicate`. Throws an `ArgumentError` with the specified `label` if the test fails.
@param value - Value to test.
@param label - Label which should be used in error messages.
@param predicate - Predicate to test against.
*/
<T>(value: unknown,label: string,predicate: BasePredicate<T>): asserts value is T;
However, the ReusableValidator returned by ow.create() is not an Assertion Functions type. ReusableValidator returns a void type!
In addition, the value argument does not seem to be of type unknown...
I have added something to help with this in #224. The problem why we can't simply write asserts value is T instead of void here is the same why the following exists:
Currently,
ow()
funciton is of type Assertion Functions.ow/source/index.ts
Lines 31 to 46 in f26115d
However, the
ReusableValidator
returned byow.create()
is not an Assertion Functions type.ReusableValidator
returns avoid
type!In addition, the value argument does not seem to be of type
unknown
...ow/source/index.ts
Lines 53 to 60 in f26115d
For this reason, using
ow.create()
in TypeScript does not provide proper type validation.The text was updated successfully, but these errors were encountered: