0.4.7 • Published 1 year ago

@typeio/type v0.4.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

typeio

Typescript-first schema declaration, validation library and contextual transformation. Inspired from io-ts and joi.

typeio is still in alpha. Expect bugs and api changes!

Features

  • Typescript-first library which support type inference and schema type properly.
  • Support class-based or schema-based declaration
  • Powerful schema declaration, can be used to type-guard and validation. Can also be reused for multiple use case such as json, bson, or other
  • Type coercion, allow data transformation from/to different type for input/output.
  • Fast and Extensible, build your own schema/codec/parser

Please see the documentation for more details.

inference inference

Docs

Built-in

Schema

TypeTypescriptBuilder
stringstringt.string()
numbernumbert.number()
booleanbooleant.boolean()
literal'A't.literal('A')
unknownunknownt.unknown()
anyanyt.any()
nullnullt.null()
nullableA \| nullt.nullable(t.type(A))
undefinedundefinedt.undefined()
optionalA \| undefinedt.undefined(t.type(A))
arrayarrayt.array(T)
typeAt.type(A)
object{a:A}t.object({a: t.type(A)})
unionA \| Bt.union(t.type(A), t.type(B))
intersectA & Bt.intersect(t.type(A), t.type(B))

Parser

NameDescription
BaseParserBase parser that contain no codecs.
ParserParser with some some built in primitive Codec. You mostly use this
0.4.5

1 year ago

0.4.4

2 years ago

0.4.7

1 year ago

0.4.6

1 year ago

0.4.1

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.0

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago