Skip to content

Incorrectly casts export type X declarations to classΒ #14

@D-Pow

Description

@D-Pow

If I use any combination of

// types.ts
/**
 * Valid JSON primitive types.
 *
 * @arbitrary_tag IncludesNotAddingTag
 */
export type JsonPrimitive = (
    | string
    | number
    | boolean
    | null
    | JsonPrimitive[]
    | { [key: string]: JsonPrimitive }
);

with

// index.js
// includes any combination of @typedef {typeof import...}, lack of typeof, etc.
/** @typedef {import('./types').JsonPrimitive} JsonPrimitive */

The plugin fails with:

Error: Invalid docstring * @typedef {Class<import('./types').JsonPrimitive>} JsonPrimitive in /path/to/index.js

TL;DR

Don't automatically cast type declarations to class (who else does that?).

Edit: I realize this plugin was made primarily for classes, but for > 1k downloads, I'd expect it to be a bit more supportive of other types as well.

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