io-ts-with-optional
TypeScript icon, indicating that this package has built-in type declarations

2.2.20 • Public • Published

build status npm downloads

Build based on gcanti/io-ts, and add optional method to allow to define an optional properties more readable.

const AType = t.type({
  a: t.string,
  b: t.optional(t.string), // define an optional property
});

type A = t.TypeOf<typeof AType>;
//// Type A is like following:
// interface A {
//   a: string;
//   b?: string; // define an optional property
// }

Installation

To install the stable version

npm i io-ts fp-ts

Note. fp-ts is a peer dependency for io-ts

Usage

Stable features

Experimental modules (version 2.2+)

Experimental modules (*) are published in order to get early feedback from the community, see these tracking issues for further discussions and enhancements.

The experimental modules are independent and backward-incompatible with stable ones.

(*) A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice.

Package Sidebar

Install

npm i io-ts-with-optional

Weekly Downloads

17

Version

2.2.20

License

MIT

Unpacked Size

465 kB

Total Files

83

Last publish

Collaborators

  • colinhan