import { readonly } from "https://deno.land/x/fun@v2.0.0-alpha.6/eq.ts";
Create a Eq that casts the inner type of another Eq to Readonly.
Examples
Example 1
Example 1
import { readonly, fromEquals } from "./eq.ts";
// This has type Eq<Array<string>>
const EqMutableArray = fromEquals<Array<string>>(
(first, second) => first.length === second.length
&& first.every((value, index) => value === second[index])
);
// This has type Eq<Readonly<Array<string>>>
const EqReadonlyArray = readonly(EqMutableArray);