question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

typescript doc comments?

See original GitHub issue

Hi, I am working on integrating zod into one of my current projects. In the past I have used a combination of declared typescript types and manual validation. Zod is obviously a lot nicer to use on the validation side, but there is one piece from declaring types that I cannot find a replacement for in zod. That is doc comments

E.g. if I have the following struct defined:

interface Media {
  /**
  * The location of the media file
  */
  filepath: string
}

what would the equivalent comment look like in zod? These are important for my project, which relies on deno’s documentation generation for user docs (see here https://doc.deno.land/https/raw.githubusercontent.com/andykais/ffmpeg-templates/main/lib/template_input.ts#Template)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
andykaiscommented, Sep 27, 2021

You’ll find it much easier and less prone to edge cases if you treat your schemas as the source of truth

Well the whole point of this issue is that documentation tools using zod as the source of truth are insufficient. I understand that this is a limitation of the language though.

1reaction
andykaiscommented, Oct 21, 2021

@ptboyer thanks for sharing. I ended up going with an existing library https://github.com/DetachHead/ts-helpers/issues/97. If thats missing some use cases then let them know! Until ts-helpers publishes to deno.land https://github.com/DetachHead/ts-helpers/issues/107, the imports look like this:

import { exactly } from 'http://esm.sh/@detachhead/ts-helpers@9.0.0-9b4a478c3a63affa1f7f29aeabc2e5f76583ddfc/dist/utilityFunctions/misc'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Doc Comments - TypeDoc
Doc Comments. TypeDoc implements a minimal parser for your comments which extracts TSDoc/JSDoc tags and recognizes code blocks to ignore decorators.
Read more >
JSDoc Reference - TypeScript: Documentation
The list below outlines which constructs are currently supported when using JSDoc annotations to provide type information in JavaScript files.
Read more >
Where is the syntax for TypeScript comments documented?
The right syntax is now the one used by TSDoc. It will allow you to have your comments understood by Visual Studio Code...
Read more >
microsoft/tsdoc: A doc comment standard for TypeScript - GitHub
A doc comment standard for TypeScript. Contribute to microsoft/tsdoc development by creating an account on GitHub.
Read more >
TSDoc
A doc comment standard for TypeScript. ... TSDoc is a proposal to standardize the doc comments used in TypeScript code, so that different...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found