ts-partial-types

Variations on the `Partial` and `Pick` types for TypeScript

Usage no npm install needed!

<script type="module">
  import tsPartialTypes from 'https://cdn.skypack.dev/ts-partial-types';
</script>

README

ts-partial-types

PartialOnly<T, U>

TypeScript's Partial<T> mapped type makes all of the type's properties optional. This variation makes only the specified keys optional.

PartialExcept<T, U>

TypeScript's Partial<T> mapped type makes all of the type's properties optional. This variation makes all properties optional except those specified.

Without<T, U>

TypeScript's Pick<T, K> mapped type returns a type that only includes the specified keys. This type complements it by returning a type with only those keys that are not specified.

PartialWithout<T, U>

TypeScript's Pick<T, K> mapped type returns a type that only includes the specified keys. This type complements it by returning a type with only those keys that are not specified, and makes all of the remaining properties optional as in Partial<T>.

updateObject

Update an object's properties with values from an object with a subset of the object's properties. Returns a new object.

This is essentially a typed wrapper around the merge function from Lodash.