Hacker GitHub

← All repos

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

Mentions per year 61 mentions · busiest year 2020 (23)
20082026
  1. …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...
  2. …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
  3. …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
  4. 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
  5. …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
  6. 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)
  7. Don’t forget https://github.com/gcanti/io-ts
    comment by catlifeonmars · 2021-06-26 · in Parse, Don't Validate (2019)
  8. 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
  9. Similar thing for TypeScript: https://github.com/gcanti/io-ts
    comment by brundolf · 2021-05-15 · in Parsix: Parse Don't Validate
  10. 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?
  11. …io-ts[1] which has a functional approach using Eithers to encapsulate errors/success. [1]: https://github.com/gcanti/io-ts
  12. …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)
  13. 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
  14. …. 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
  15. …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
  16. ▲ 1
    io-ts: Runtime representation for TypeScript types
    story by janpot · 2021-01-21 · 0 comments
  17. …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?
  18. 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
  19. …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
  20. …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
  21. …year and I have quite a large codebase in production. The errors you mention do not happen. [0] - https://github.com/gcanti/io-ts
  22. …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
  23. 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
  24. …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
  25. That’s where you use something like https://github.com/gcanti/io-ts to enforce types on unknown data at runtime.
  26. …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
  27. Also https://github.com/gcanti/io-ts
    comment by wereHamster · 2020-05-29 · in Type Safety with Native JavaScript
  28. …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
  29. …[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
  30. …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
  31. There are things like io-ts that do exactly this: http://github.com/gcanti/io-ts
  32. …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…
  33. …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
  34. …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…
  35. …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...
  36. io-ts [1] is what I think most people use for this 1: https://github.com/gcanti/io-ts
  37. I mention io-ts https://github.com/gcanti/io-ts in the post
    comment by paulcowan1970 · 2020-01-15 · in Problems with TypeScript
  38. 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
  39. 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
  40. …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
  41. …counts. Write well typed runtime code, get type safety and runtime safety. See io-ts as an example: https://github.com/gcanti/io-ts
    comment by eyelidlessness · 2019-11-29 · in PHP 7.4
  42. …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
  43. …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:…
  44. …. 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
  45. …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
  46. …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…
  47. 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.
  48. …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
  49. …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
  50. ▲ 2
    Io-ts: runtime types for IO decoding/encoding in TypeScript
    story by fanf2 · 2019-05-30 · 0 comments