gcanti / io-ts

Runtime type system for IO decoding/encoding
https://gcanti.github.io/io-ts/
MIT License
6.68k stars 331 forks source link

How to generate documentation for types generated with `t.TypeOf` #692

Open ships opened 1 year ago

ships commented 1 year ago

📖 Documentation

I would love some hints included in this repository as to how the generated types can be conveniently documented. This could be links to examples of projects using generators, references to generator tools that work well with io-ts, description of how TypeOf works so that the types are knowable to tsc...

I saw https://github.com/gcanti/io-ts/issues/201 give an example of how VSCode can infer comments for individual fields. However, when I simply run typedoc against my project, it cleanly copies the = t.TypeOf<IdAndOptionalString> (name is just an example) statement rather than showing me the type as tsc does when a type error is detected (like { id: string } & { name?: string }.

ships commented 1 year ago

I have played with your docs-ts library (see my WIP here) as well as typedoc, and they both show the same behavior. And yet tsc does still display the correct and complete exact union & intersection type. Am I missing a step?