gcanti/io-ts
View on GitHub ↗ ★ 6,810 TypeScript
Runtime type system for IO decoding/encoding
61 mentions on Hacker News by 40 people: 2 stories, 59 comments · first 2017-04-12 · latest 2022-09-23
20082026
-
…can be extracted using TypeScript's type manipulation utilities. It does support generics [0]. [0] https://github.com/gcanti/io-ts/blob/master/index.md#generic...
comment by wk_end · 2022-09-23 · in Show HN: Ezno, a type checker for JavaScript and optimiser for React -
…a first-party solution would definitely be nicer. But it works, and it's amazing that it works. [0] https://github.com/gcanti/io-ts
comment by wk_end · 2022-09-23 · in Show HN: Ezno, a type checker for JavaScript and optimiser for React -
…type-checking on io boundaries (and you may have a lot of them in a front-end application). [0]: https://github.com/gcanti/io-ts/blob/master/index.md#typescr...
comment by egeozcan · 2022-03-03 · in We don't need runtime type checks -
Consider using https://github.com/gcanti/io-ts to help with that...
comment by andy_ppp · 2021-10-04 · in Things Go needs more than generics -
…is why I do not agree with the claim TypeScript's value add disappears from remote fetches. [0]: https://github.com/gcanti/io-ts
comment by nawgz · 2021-06-28 · in JavaScript Is Weird -
Check out https://github.com/gcanti/io-ts/blob/master/index.md instead. I find it more composable and you can define a codec and get a native type from it so you are only defining things once.
comment by hermanradtke · 2021-06-26 · in Parse, Don't Validate (2019) -
Don’t forget https://github.com/gcanti/io-ts
comment by catlifeonmars · 2021-06-26 · in Parse, Don't Validate (2019) -
Use io-ts: https://github.com/gcanti/io-ts You define a decoder schema, and then the resulting TS type gets automatically derived for you. You can then run data through the decoder, it will err if there's a mismatch, or return a value of…
comment by brundolf · 2021-05-15 · in Parsix: Parse Don't Validate -
Similar thing for TypeScript: https://github.com/gcanti/io-ts
comment by brundolf · 2021-05-15 · in Parsix: Parse Don't Validate -
https://github.com/gcanti/fp-ts https://github.com/gcanti/io-ts If you're using TS these are pretty much footgun eliminator.
comment by valand · 2021-04-20 · in What's in the Box? -
…io-ts[1] which has a functional approach using Eithers to encapsulate errors/success. [1]: https://github.com/gcanti/io-ts
comment by harg · 2021-04-12 · in Using the switch(true) pattern in JavaScript -
…more libraries I know which are great for that: * Zod: https://github.com/colinhacks/zod * io-ts: https://github.com/gcanti/io-ts (for the more functional-programming-oriented)
comment by Shacklz · 2021-03-02 · in How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan -
Type guard in the example should use runtime type checkers or codec like io-ts ( https://github.com/gcanti/io-ts ), otherwise it will just become a type-assertion with partial correctness. With codec, one can make sure that the type is…
comment by valand · 2021-02-03 · in Bad TypeScript Habits -
…. Or if brave enough to dive into the deep end of FP, io-ts is nice. https://github.com/gcanti/io-ts
comment by elnygren · 2021-02-02 · in Bad TypeScript Habits -
…we use io-ts to validate all of our endpoints, but simple type guards could achieve the same goal. https://github.com/gcanti/io-ts
comment by sakarisson · 2021-02-02 · in Bad TypeScript Habits -
…devs. [1]: https://github.com/natemoo-re/microsite [2]: https://github.com/callstack/linaria [3]: https://github.com/gcanti/io-ts
comment by eyelidlessness · 2021-01-15 · in Ask HN: What are you working on? -
Happened to me This helps me with it at the cost of a little bit more lines of code https://github.com/gcanti/io-ts
comment by valand · 2020-11-20 · in TypeScript 4.1 -
…to help make this easier [1]. 0: https://www.typescriptlang.org/docs/handbook/advanced-types.... 1: https://github.com/gcanti/io-ts
comment by __ryan__ · 2020-11-20 · in TypeScript 4.1 -
…I used io-ts when the documentation is still on its root README.md. Apparently it has been moved to https://github.com/gcanti/io-ts/blob/master/index.md
comment by valand · 2020-09-12 · in From Rust to TypeScript -
…year and I have quite a large codebase in production. The errors you mention do not happen. [0] - https://github.com/gcanti/io-ts
comment by loxs · 2020-07-09 · in Moving from TypeScript to Rust / WebAssembly -
…and return an error if it does not have the correct structure, you can use libraries like IO-TS ( https://github.com/gcanti/io-ts/blob/master/index.md ) to make that happen. i do not know how you get this "for free" in Rust, i know there…
comment by asdf-asdf-asdf · 2020-07-09 · in Moving from TypeScript to Rust / WebAssembly -
Instead of ts-runtime, use io-ts ( https://github.com/gcanti/io-ts ). That one is actually maintained, unlike ts-runtime!
comment by wereHamster · 2020-06-21 · in Deno will stop using TypeScript -
…for speed up here - https://github.com/swc-project/swc Cool project for runtime checking with ts - https://github.com/gcanti/io-ts Edit: Remove unmaintained runtime type checking library.
comment by searchableguy · 2020-06-21 · in Deno will stop using TypeScript -
That’s where you use something like https://github.com/gcanti/io-ts to enforce types on unknown data at runtime.
comment by myvoiceismypass · 2020-06-09 · in Design Doc: Use JavaScript instead of TypeScript for internal Deno Code -
…detail and heavy syntax. For example, look at the interpreter interface in this typescript file: https://github.com/gcanti/io-ts/blob/master/src/Schema.ts#L2... Granted, genetics don't need to be done that way, but it is among the more…
comment by zdragnar · 2020-06-01 · in Featherweight Go -
Also https://github.com/gcanti/io-ts
comment by wereHamster · 2020-05-29 · in Type Safety with Native JavaScript -
…to open an issue to track our progress there if you think this feature will be useful for you. [1] https://github.com/gcanti/io-ts
comment by alde · 2020-05-26 · in Show HN: PgTyped – Typesafe SQL in TypeScript and Postgres -
…[1] but it feels like too much wiring to compensate for the lack of compiled interfaces. [0]: https://github.com/gcanti/io-ts [1]: https://github.com/Microsoft/tsyringe
comment by egeozcan · 2020-05-25 · in API with NestJS #3. Authenticating users with bcrypt, Passport, JWT, and cookies -
…be avoided It's not perfect and a bit of a bolt-on, but io.ts works reasonably well in this area: https://github.com/gcanti/io-ts
comment by zbentley · 2020-04-25 · in A one-line package broke `npm create-react-app` -
There are things like io-ts that do exactly this: http://github.com/gcanti/io-ts
comment by andy_ppp · 2020-04-08 · in How porting to TypeScript solved our API woes -
…library, giving us runtime type checking on top of the native static type checking experience. [0] https://github.com/gcanti/io-ts [1] https://github.com/pelotom/runtypes [2] mobx-state-tree also has a schema validation library that works…
comment by AriaMinaei · 2020-03-13 · in Designing the perfect TypeScript schema validation library -
…library. It gives you both runtime validation and static type safety with very simple syntax. [1]: https://github.com/gcanti/io-ts
comment by eyelidlessness · 2020-03-11 · in MessagePack: like JSON, but fast and small -
…is definitely something I also miss. For input validation and Optional/Either types, io-ts/fp-ts ( https://github.com/gcanti/io-ts ) fulfill my needs perfectly, especially io-ts is something I can't recommend enough. Saved me so many…
comment by Shacklz · 2020-02-02 · in TypeScript’s quirks: How inconsistencies make the language more complex -
…than my solution, and I'm considering switching now! 1: https://github.com/pelotom/runtypes 2: https://github.com/gcanti/io-ts/blob/master/src/ThrowReporte...
comment by shhsshs · 2020-02-01 · in TypeScript’s quirks: How inconsistencies make the language more complex -
io-ts [1] is what I think most people use for this 1: https://github.com/gcanti/io-ts
comment by stefan_ · 2020-02-01 · in TypeScript’s quirks: How inconsistencies make the language more complex -
I mention io-ts https://github.com/gcanti/io-ts in the post
comment by paulcowan1970 · 2020-01-15 · in Problems with TypeScript -
friendly tips: runtime type checks are available https://github.com/gcanti/io-ts https://github.com/pelotom/runtypes
comment by valand · 2020-01-15 · in Problems with TypeScript -
friendly tips: runtime type checks are available https://github.com/gcanti/io-ts https://github.com/pelotom/runtypes
comment by valand · 2020-01-15 · in Problems with TypeScript -
…tips: you can replace any with unknown. Other friendly tips: runtime type checks are available https://github.com/gcanti/io-ts https://github.com/pelotom/runtypes
comment by valand · 2020-01-15 · in Problems with TypeScript -
…first, here's a library that is basically an implementation of the ideas OP tries to convey: https://github.com/gcanti/io-ts Can't recommend using this library enough; being able to essentially reject any input (e.g. json over http) at…
comment by Shacklz · 2019-11-09 · in Parse, Don’t Validate -
…way that doesn't involve another build step. A popular library I've often seen mentioned is io-ts: https://github.com/gcanti/io-ts One that I've taken a liking to, backed by ajv for JSON schema validation, is:…
comment by lioeters · 2019-09-18 · in Validating Data with JSON Schema, Angular and TypeScript -
…. It generates validators for your interfaces/types/etc at compile-time. [1]: https://github.com/gcanti/io-ts [2]: https://github.com/woutervh-/typescript-is
comment by frankpf · 2019-09-12 · in TypeScript 3.7: The Biggest Features and How to Use Them -
…briefly experimented with. [1] https://lorefnon.tech/2018/05/13/reasonml-vs-typescript-firs... [2] https://github.com/gcanti/io-ts/issues/201#issuecomment-4347... [3] https://github.com/ts-delight [4] https://github.com/kentcdodds/babel-plu…
comment by waltera · 2019-09-04 · in TypeScript vs. ReasonML -
…badly or insufficiently typed third party libraries there's a fantastic typescript library, io-ts ( https://github.com/gcanti/io-ts ), that provides the ability to declare runtime types variables that you can infer compile time types from…
comment by resynthesize · 2019-06-21 · in Open-sourcing Sorbet: a fast, powerful type checker for Ruby -
That's probably the only real case, yes. And still, even this is a non-issue with things like io-ts https://github.com/gcanti/io-ts This is my go to tool (and language) nowadays when I need to do something JSON heavy for a prototype.
comment by loxs · 2019-06-20 · in Open-sourcing Sorbet: a fast, powerful type checker for Ruby -
…with typescript. It's not an out of the box feature but a number of libraries allow it, e.g. https://github.com/gcanti/io-ts
comment by phpnode · 2019-06-20 · in Migrating 300k LOC from Flow to TypeScript -
…they also let you extract static types from those schemas so you don’t have to write things twice: https://github.com/gcanti/io-ts https://github.com/pelotom/runtypes
comment by breatheoften · 2019-06-20 · in Migrating 300k LOC from Flow to TypeScript -
I use https://github.com/gcanti/io-ts for the runtime checking. It is similar to tcomb (same author)! You can even define the type via io-ts and then make a TypeScript interface out of it! Given this, and the other libraries that do…
comment by hermanradtke · 2019-05-30 · in TypeScript 3.5 -
…checking that library out for anyone who knows about DDD or wants to abstract their mapping code. https://github.com/gcanti/io-ts
comment by dfee · 2019-04-07 · in Value Objects – DDD with TypeScript