import { JsonDecoder } from 'ts.data.json';
interface Person {
name: string;
}
const personDecoder = JsonDecoder.object<Person>(
{ name: JsonDecoder.string },
'Person'
);
const invalidPerson = { name: 1 };
personDecoder
.decodePromise(invalidPerson)
.then(console.log)
.catch(console.error);
// <Person> decoder failed at key "name"
// with error: 1 is not a valid string