v2.1.0
Feature
- Added
FromDecoder<D>
to infer types from decoder declarations. (docs)
Without FromDecoder
type User = {
firstname: string;
lastname: string;
};
const userDecoder = JsonDecoder.object<User>(
{
firstname: JsonDecoder.string,
lastname: JsonDecoder.string
},
'User'
);
With FromDecoder
const userDecoder = JsonDecoder.object(
{
firstname: JsonDecoder.string,
lastname: JsonDecoder.string
},
'User'
);
type User = FromDecoder<typeof userDecoder>;