@esfx/type-model
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@esfx/type-model

The @esfx/type-model package provides a number of utility types for TypeScript.

Overview

Installation

npm i @esfx/type-model

Usage

// TypeScript
import { Diff } from "@esfx/type-model";

type A = { x: number, y: string };
type B = { x: number };
type C = Diff<A, B>; // { y: string }

API

You can read more about the API here.

Test Helpers

This package also provides two helper types that can be used to test complex types:

import { Test, ExpectType } from "@esfx/type-model/test";

// test suite
type _ = [
    Test<ExpectType<Actual, Expected>> // reports a type error if `Actual` and `Expected` aren't the same type
];

Readme

Keywords

none

Package Sidebar

Install

npm i @esfx/type-model

Weekly Downloads

3,458

Version

1.0.0

License

Apache-2.0

Unpacked Size

83.2 kB

Total Files

13

Last publish

Collaborators

  • rbuckton