Rest
...guard: readonly [A, B]Given one or multiple Type Guard as arguments, returns a Type Guard that checks if the given value matches all given Type Guard.
Same as guardAll
, but each Type Guard must implement the previous Type Guard output, which will be inferred up to 8 Type Guard.
const isFooBar = guardPipe(
matchType('string'),
(val): val is `foo${string}` => val.startsWith('foo'),
(val): val is 'foobar' => val === 'foobar'
);
const test = {} as unknown;
if(isFooBar(test)){
test; // 'foobar'
}
Rest
...guard: readonly [A, B, C]Given one or multiple Type Guard as arguments, returns a Type Guard that checks if the given value matches all given Type Guard.
Same as guardAll
, but each Type Guard must implement the previous Type Guard output, which will be inferred up to 8 Type Guard.
const isFooBar = guardPipe(
matchType('string'),
(val): val is `foo${string}` => val.startsWith('foo'),
(val): val is 'foobar' => val === 'foobar'
);
const test = {} as unknown;
if(isFooBar(test)){
test; // 'foobar'
}
Rest
...guard: readonly [A, B, C, D]Given one or multiple Type Guard as arguments, returns a Type Guard that checks if the given value matches all given Type Guard.
Same as guardAll
, but each Type Guard must implement the previous Type Guard output, which will be inferred up to 8 Type Guard.
const isFooBar = guardPipe(
matchType('string'),
(val): val is `foo${string}` => val.startsWith('foo'),
(val): val is 'foobar' => val === 'foobar'
);
const test = {} as unknown;
if(isFooBar(test)){
test; // 'foobar'
}
Rest
...guard: readonly [A, B, C, D, E]Given one or multiple Type Guard as arguments, returns a Type Guard that checks if the given value matches all given Type Guard.
Same as guardAll
, but each Type Guard must implement the previous Type Guard output, which will be inferred up to 8 Type Guard.
const isFooBar = guardPipe(
matchType('string'),
(val): val is `foo${string}` => val.startsWith('foo'),
(val): val is 'foobar' => val === 'foobar'
);
const test = {} as unknown;
if(isFooBar(test)){
test; // 'foobar'
}
Rest
...guard: readonly [A, B, C, D, E, F]Given one or multiple Type Guard as arguments, returns a Type Guard that checks if the given value matches all given Type Guard.
Same as guardAll
, but each Type Guard must implement the previous Type Guard output, which will be inferred up to 8 Type Guard.
const isFooBar = guardPipe(
matchType('string'),
(val): val is `foo${string}` => val.startsWith('foo'),
(val): val is 'foobar' => val === 'foobar'
);
const test = {} as unknown;
if(isFooBar(test)){
test; // 'foobar'
}
Rest
...guard: readonly [A, B, C, D, E, F, G]Given one or multiple Type Guard as arguments, returns a Type Guard that checks if the given value matches all given Type Guard.
Same as guardAll
, but each Type Guard must implement the previous Type Guard output, which will be inferred up to 8 Type Guard.
const isFooBar = guardPipe(
matchType('string'),
(val): val is `foo${string}` => val.startsWith('foo'),
(val): val is 'foobar' => val === 'foobar'
);
const test = {} as unknown;
if(isFooBar(test)){
test; // 'foobar'
}
Rest
...guard: readonly [A, B, C, D, E, F, G, H]Generated using TypeDoc
Given one or multiple Type Guard as arguments, returns a Type Guard that checks if the given value matches all given Type Guard. Same as
guardAll
, but each Type Guard must implement the previous Type Guard output, which will be inferred up to 8 Type Guard.Example