Skip to main content
Module

x/ts_matches/src/parsers/simple-parsers.ts>guard

Being able to pattern match in typescript
Go to Latest
function guard
import { guard } from "https://deno.land/x/ts_matches@v5.2.0/src/parsers/simple-parsers.ts";

Create a custom type guard

Type Parameters

A
B extends A

Parameters

test: (value: A) => value is B

A function that will determine runtime if the value matches

optional
testName: string

A name for that function, useful when it fails