yarn add structype
import { Type, String, Number } from 'structype'
export const Person = Type({
firstName: String,
lastName: String,
age: Number
})
export type Person = typeof Person.type
function handleInput(obj: any) {
if (Person.test(obj)) {
obj // x is a Person
} else {
obj // x is still any
}
}