Skip to content

The generated. d.ts file is missing jsdoc comments #60404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
6 tasks done
yamiwamiyu opened this issue Nov 4, 2024 · 1 comment
Closed
6 tasks done

The generated. d.ts file is missing jsdoc comments #60404

yamiwamiyu opened this issue Nov 4, 2024 · 1 comment
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Milestone

Comments

@yamiwamiyu
Copy link

πŸ” Search Terms

".d.ts","jsdoc"

βœ… Viability Checklist

⭐ Suggestion

When generating .d.ts, if the referenced type is not exported, take one of the following actions:

  • Compile error, indicating that necessary types have not been exported
  • Automatically generate non exported types into .d.ts
  • Maintain the existing implementation and only add jsdoc comments(prefered)

Here is a simple example

  1. I wrote a simple library 1
// myLib/index.d.ts
type FilterString<T> = {
    [K in keyof T as T[K] extends string ? never : K]: T[K];
}

export function define<T>(p: T): FilterString<T>;
  1. Reference library 1 in library 2
import { define } from 'myLib'

export const test = define({
  /** jsdoc 1 */
  a: 5,
  /** jsdoc 2 */
  b: '',
})
  1. Compile library 2 to generate .d.ts
// without jsdoc: type FilterString without export
export declare const test: {
     a: number; // Don't let jsdoc be lost (prefered)
};
// with jsdoc: type FilterString with export
// Alternatively, generate the FilterString type into .d.ts as well
export declare const test: import("myLib").FilterString<{
     /** jsdoc 1 */
    a: number;
    /** jsdoc 2 */
    b: string;
}>;

πŸ“ƒ Motivating Example

When writing libraries, maintain consistent JSDoc annotations between the development and release environments

πŸ’» Use Cases

  1. When writing libraries, maintain consistent JSDoc annotations between the development and release environments
  2. I only discovered that JSDoc was missing when it was released
  3. Manually find the type that has not been exported and add it to the export
@Andarist
Copy link
Contributor

Andarist commented Nov 4, 2024

I'm not entirely sure on the spot but there is a good chance that this would get fixed with #60005 when generating (and publishing) declaration maps

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Help Wanted You can do this Experience Enhancement Noncontroversial enhancements labels Nov 6, 2024
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants