oliverjash / decode-ts Goto Github PK
View Code? Open in Web Editor NEWTypeScript compatible value decoding.
TypeScript compatible value decoding.
Hey @OliverJAsh
Thanks for creating this package Would be great if you could include some examples of how you'd use this lib in a production app. I have a very simple example:
const Todo = t.interface({
id: t.number,
completed: t.boolean
});
fetch('https://jsonplaceholder.typicode.com/todos')
.then(r => r.json())
.then(b => jsonDecodeString(t.array(Todo))(JSON.stringify(b)))
.then(t => console.log(t));
But i'd be interested to see how you handle errors, how you handle the Either
type (map, fold etc)
Thanks
I'd like to try out decode-ts
, but right now its dependencies are fp-ts ^0.6.2
and io-ts ^0.8.2
.
Do you have plans to upgrade decode-ts
to use version ^1
of fp-ts
and io-ts
?
It would be nice if JsonDecodeError
would be added to the public interface. That would allow me to reuse existing errors or even better to extend the union type for longer parsing pipelines. Currently I need to export it from 'decode-ts/target/types'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.