Skip to content

Use JSDoc with tsc for strong static typing #65

Closed as not planned
Closed as not planned

Description

@brody2consult

It is possible to use JSDoc comments with the TypeScript compiler to enforce some strong typing, as documented in the following resources:

Here is the best example I have found: prettier/prettier#6313

I would personally favor this alternative over porting to TypeScript as proposed in #64.

Activity

  1. changed the title [-]Use JSDoc with tsc for strong typing[/-] [+]Use JSDoc with tsc for strong static typing[/+] on Oct 2, 2019
  2. fbartho commented on Oct 10, 2019

    @fbartho
    Contributor

    I'm also looking to do a technique like this for another node library I contribute to.

    I think this is set up to work best with the next major version of TypeScript coming out at the beginning of next month, as they're making changes to support parsing JS+JSDoc via TypeScript-compiler.

    Specifically, I think this PR was a blocker: microsoft/TypeScript#32372

    If JSDoc is super detailed and robust, then theoretically, the .d.ts declaration file could be directly output from there. -- From my initial work writing the JSDoc types for another library, however, it was way clunkier and harder to do than directly writing TypeScript, and nothing helped guide correctness in the JSDoc types. :(

  3. erisu commented on Jun 16, 2026

    @erisu
    Member

    I think the tsc angle can be revisited later if needed once the JSDoc coverage and structure are in place. Since this ticket has become stale, I’d like to focus on the JSDoc improvements first as the immediate step forward.

    There hasn't been any activity on this for several years, so I’m closing it in favor of consolidating the work under #171.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions