Skip to content
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

Incorrectly casts export type X declarations to class #14

Open
D-Pow opened this issue May 13, 2021 · 0 comments
Open

Incorrectly casts export type X declarations to class #14

D-Pow opened this issue May 13, 2021 · 0 comments

Comments

@D-Pow
Copy link

D-Pow commented May 13, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant