Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Incorrectly casts `export type X` declarations to class

Aperta
#14 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, typescript

Direzione di ricerca

Reproduce the failure with the types.ts export type declaration and the index.js JSDoc typedef shown in the issue. Trace the plugin's handling of TypeScript type declarations and typedef imports; done means JsonPrimitive is no longer cast to Class and the documented example parses without the Invalid docstring error.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
JavaScript
Stelle
24
Fork
13
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openlayers/jsdoc-plugin-typescript

Tutte le issue di openlayers/jsdoc-plugin-typescript

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.