Skip to content
/ types Public
forked from alloc/types

Common types for TypeScript

License

Notifications You must be signed in to change notification settings

v-gjy/types

 
 

Repository files navigation

@alloc/types

Common types for TypeScript

import { Lookup } from '@alloc/types'
import { ElementType } from '@alloc/types/react'

Basic

  • Solve<T> for solving generic types

  • Remap<T> to simplify & out of an object type

  • Pick<T, K> the same as built-in Pick but wrapped with Solve

  • Overwrite<T, U> for merging two object types (where U takes precedence)

  • MergeUnknown<T, U> for merging two object types (where T takes precedence)

  • MergeDefaults<T, U> for making T properties optional if they exist in U

React

  • ElementType<P> as a workaround for #34237

  • ComponentPropsWithRef<T> which uses ElementType