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.

Discussion: How to document inferred types using TSDoc

See original GitHub issue

I have a complex type that is inferred from yup schema, so something like:

export type Config =  y.InferType<typeof isConfig>

How would one ts-doc its properties manually?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
jayarjocommented, Jun 5, 2020

It’s more about not having to update types in several places rather than elegance. Here’s the slice of type that is generated and exported to corresponding d.ts file:

declare const isConfig: y.ObjectSchema<{
    image: string;
    name: string;
    env: object;
    buildArgs: object;
    exposedPorts: any;
    networkMode: string;
    bindMount: any;
    startupTimeout: number;
    cmd: string;
    healthCheck: any;
    auth: any;
    useDefaultLogDriver: boolean;
}>;
0reactions
jayarjocommented, Jun 6, 2020

@octogonz

  1. that’s what doc parser can try to determine itself
  2. how do you structure them for @param?
Read more comments on GitHub >

github_iconTop Results From Across the Web

TSDoc
What is TSDoc? TSDoc is a proposal to standardize the doc comments used in TypeScript code, so that different tools can extract content...
Read more >
Documentation - Type Inference - TypeScript
In most cases, type inference is straightforward. In the following sections, we'll explore some of the nuances in how types are inferred.
Read more >
TSDoc: A TypeScript Source Code Documentation Format
TSDoc proposes a new format for documenting TypeScript source code. ... preoccupied with providing type annotations for plain JavaScript, ...
Read more >
React TypeScript CheatSheet - Breword 文档集合
If you are returning an array in your Custom Hook, you will want to avoid type inference as TypeScript will infer a union...
Read more >
Quick Start Guide - typegoose
Typegoose is a "wrapper" for easily writing Mongoose models with ... Also tsdoc comments are not transferred when using mongoose's inferred types.
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