Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

Typescript types should parse correctly #50

Description

@sandersn

The Typescript language service supports Typescript types in jsdoc. That means that anybody editing Javascript code with the Typescript language service, such as users of VS Code, Webstorm, Visual Studio, Sublime, Vim or Emacs, will expect eslint rules to understand Typescript types. Since eslint-plugin-jsdoc is the now-recommended way to lint jsdoc, and it relies on jsdoctypeparser, jsdoctypeparser should parse Typescript types.

Here's a list of the types that I've found so far that need support:

  • Tuple types: [string, string]
    • Labelled tuple types: [a: string, b: string]
    • Multi-variadic tuple types: [...A, ...B]
  • Arrow functions: (x: string) => number
  • Signatures in object literal types: { x: string, (some: string, func: string) => void }
  • Construct signatures: { staticX: string, new (some: string, ctor: string): C }
  • Import types: import("./package").Type
  • Mapped types, index access types, keyof types : { [K in keyof T]: Boxed<T[K]> }
  • Conditional type: A extends B ? C : D
  • Type queries: typeof someVariable
  • Readonly properties { readonly a: string }
  • Type parameters on arrow functions: <T>(a: T) => T
  • Intersection type: A & B
  • Type guard: param is Type
    • Assertion functions: asserts param is Type

I've got type queries working and import types mostly working, so I'll probably create a PR for those before continuing with the rest.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions