UNPKG

synapse-react-client

Version:

[![Build Status](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client.svg?branch=main)](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synaps

24 lines (23 loc) 593 B
/** * Makes fields for a type required. * For example: * * type FooBarBaz = { * foo: string * bar?: string * baz?: string * } * * To require the 'baz' property * type RequireBar = RequiredProperties<FooBarBaz, 'baz'> * Would result in : * RequireBar === { * foo: string * bar?: string * baz: string // this is now required * } * * To require multiple properties, use a String Literal union: * type RequireBarBaz = RequiredProperties<FooBarBaz, 'bar' | 'baz'> */ export declare type RequiredProperties<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;