Home > @skunkteam/types > BaseTypeImpl > andThen
Create a function with validated input.
Signature:
andThen<Return, RestArgs extends unknown[]>(fn: (value: ResultType, ...restArgs: RestArgs) => Return): (input: unknown, ...restArgs: RestArgs) => Return;
Parameter | Type | Description |
---|---|---|
fn | (value: ResultType, ...restArgs: RestArgs) => Return | the function with input to be checked |
Returns:
(input: unknown, ...restArgs: RestArgs) => Return
Note that only the first parameter to the function is checked. The resulting function can be used as a parser and integrates nicely with other types.