import { ObjectIntersectionAsserter } from "https://deno.land/x/typeguardkit@0.33.0/mod.ts";
An ObjectIntersectionAsserter
is an ObjectAsserter
for the intersection
of the asserted types of the provided ObjectAsserter
s.
Example:
import {
_string,
Asserted,
ObjectAsserter,
ObjectIntersectionAsserter,
} from "typeguardkit";
// types/entity.ts
export const _Entity = new ObjectAsserter("Entity", {
id: _string,
});
export type Entity = Asserted<typeof _Entity>;
// types/user.ts
export const _User = new ObjectIntersectionAsserter(
"User",
[
_Entity,
{
name: _string,
},
],
);
export type User = Asserted<typeof _User>;
Constructors
new
ObjectIntersectionAsserter(typeName: string, unnamed 1: [ObjectAsserter<PropertyAssertersA>, ObjectAsserter<PropertyAssertersB> | PropertyAssertersB])