Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ts_matches/src/parsers/index.ts>guard

Being able to pattern match in typescript
Go to Latest
function guard
Re-export
import { guard } from "https://deno.land/x/ts_matches@v5.2.0/src/parsers/index.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