0.2.0 • Published 7 years ago
structype v0.2.0
Install
yarn add structype
Usage
import { Type, String, Number } from 'structype'
export const Person = Type({
firstName: String,
lastName: String,
age: Number
})
export type Person = typeof Person.type
Static Type Inference
function handleInput(obj: any) {
if (Person.test(obj)) {
obj // x is a Person
} else {
obj // x is still any
}
}