Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ts_essentials/lib/types.ts

All basic TypeScript types in one place 🤙
Latest
import * as tsEssentials from "https://deno.land/x/ts_essentials@v9.1.2/lib/types.ts";

Type Aliases

Useful as a return type in interfaces or abstract classes with missing implementation

Combination of DeepPartial and DeepWritable

Like NonNullable but recursive

Recursive nullable

Recursively omit deep properties

Like Partial but recursive

Recursively pick deep properties

Like Readonly but recursive

Like Required but recursive

Recursive undefinable

Like Writable but recursive

Like Record, but can be used with only one argument. Useful, if you want to make sure that all of the keys of a finite type are used.

Given Dictionary returns T

Easily extract the type of a given array's elements

Functional programming essentials

Essentials

Mark some properties as optional, leaving others unchanged

Mark some properties as required, leaving others unchanged

Merge 2 types, properties types from the latter override the ones defined on the former type

Merge N types, properties types from the latter override the ones defined on the former type

Remove keys with never value from object type

Omit all properties of given type in object type

Easily create opaque types ie. types that are subset of their original types (ex: positive numbers, uppercased string)

Gets keys of an object which are optional

Gets keys of properties of given type in object type

Pick all properties of given type in object type

Gets keys of an object which are readonly

Gets keys of an object which are required

Like Dictionary, but:

  • ensures type safety of index access
  • does not enforce key exhaustiveness

Similar to the builtin Extract, but checks the filter strictly

Similar to the builtin Omit, but checks the filter strictly.

Type constraint for tuple inference

Convert union type to intersection #darkmagic

Easily extract the type of a given object's values

Make readonly object writable

Gets keys of an object which are writable

get the XOR type which could make 2 types exclude each other