@apollo/utils.withrequired
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

WithRequired type

This package defines the TypeScript utility type WithRequired. It transforms a type that has one or more optional fields into a type where those fields are required.

For example:

import { WithRequired } from '@apollo/utils.withrequired';

interface HasSomeOptionals {
    foo: number;
    bar?: string;
    baz?: boolean;
    quux?: string;
}

type MoreRequired = WithRequired<HasSomeOptions, 'bar' | 'baz'>;

The MoreRequired type is like HasSomeOptionals, but bar and baz are now required rather than optional. quux remains optional.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.083,022latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.083,022
2.0.1976,433
2.0.064,724
1.0.12,445
1.0.078

Package Sidebar

Install

npm i @apollo/utils.withrequired

Weekly Downloads

1,126,702

Version

3.0.0

License

MIT

Unpacked Size

3.59 kB

Total Files

10

Last publish

Collaborators

  • dkuc
  • glasser
  • trevor.scheer
  • apollo-bot