Skip to content

Use annotations to generate JSDoc comments for TS that IDEs can pick up #2

Description

@jviotti

Even things like @pattern might help here. For example:

/**
 * Represents a person in the system.
 * @description Used for user accounts and profiles.
 */
interface Person {
  /** Unique identifier (UUID v4) */
  readonly id: string;

  /**
   * Display name.
   * @example "Alice Smith"
   */
  name: string;

  /**
   * Age in years.
   * @default 18
   * @minimum 0
   */
  age?: number;

  /**
   * @deprecated Use `email` instead.
   */
  contactEmail?: string;
}

/**
 * ISO 8601 date string.
 * @pattern ^\d{4}-\d{2}-\d{2}$
 * @example "2024-01-15"
 */
type DateString = string;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions