Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

intersect

import { intersect } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/comparable.ts";

Create a Comparable for intersection types.

@example
import { intersect, struct, partial, string } from "./comparable.ts";
import { pipe } from "./fn.ts";

const { compare } = pipe(
  struct({ firstName: string }),
  intersect(partial({ lastName: string }))
);

const batman = { firstName: "Batman" };
const grace = { firstName: "Grace", lastName: "Hopper" };

const result1 = compare(batman)(grace); // false
const result2 = compare(grace)(grace); // true
function intersect<I>(second: Comparable<I>): <A>(first: Comparable<A>) => Comparable<Spread<A & I>>;
§
intersect<I>(second: Comparable<I>): <A>(first: Comparable<A>) => Comparable<Spread<A & I>>
[src]

§Type Parameters

§Parameters

§Return Type

§
<A>(first: Comparable<A>) => Comparable<Spread<A & I>>
[src]