Skip to main content
Module

x/typeguardkit/mod.ts>partial

A TypeScript module to help construct type assertion functions and type guards.
Latest
function partial
import { partial } from "https://deno.land/x/typeguardkit@0.32.1/mod.ts";

partial can be used to create a PartialAsserter without specifying a typeName.

Example:

import { _string, Asserted, ObjectAsserter, partial } from "typeguardkit";

// types/user_name.ts

export const _UserName = new ObjectAsserter("UserName", {
  firstName: _string,
  lastName: _string,
});

export type UserName = Asserted<typeof _UserName>;

// types/user_name_update.ts

export const _UserNameUpdate = partial(_UserName);

export type UserNameUpdate = Asserted<typeof _UserNameUpdate>;

Type Parameters

PropertyAsserters extends Record<string, Asserter<unknown>>