import { refinement } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { literal } = refinement;
Creates an instance of Refinement<unknown, P>
where P is a union of literal
values.
Examples
Example 1
Example 1
import * as R from "./refinement.ts";
const places = R.literal(1, 2, 3);
const result1 = places(null); // false
const result2 = places(1); // true, variable now typed as 1 | 2 | 3
const result3 = places(2); // true, variable now typed as 1 | 2 | 3
const result4 = places(10); // false
Parameters
...literals: A
Returns
Refinement<unknown, A[number]>