microsoft / microsoft/TypeScript

[PROPOSAL] Support @augments/@extends attached to an Object types

Offen
#40,071 1 Kommentar 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

Search Terms

jsdoc extends object

Suggestion

Support @augments/@extends attached to an Object types.

Actually, *Storm IDEs are following it, on intellisense but tsc complains by

JSDoc '@augments' is not attached to a class.

Use Cases

Provide a way to type the derivating (merged) result of any objects to a single one.

Examples

    /**
     * @typedef Obj
     * @type {Object}
     */
    
    /**
     * @typedef Properties
     * @type {Object}
     */
    
    /**
     * @typedef Return
     * @type {Object}
     * @augments Obj
     * @augments Properties
     */
    
    /**
     * @type {Obj} obj
     */
    const obj = {
      /**
       * @param {Properties} [properties]
       * @returns {Return}
       */
      derivate ({ ...properties } = {}) {
        return { ...this, ...properties }
      }
    }

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code

  • This wouldn't change the runtime behavior of existing JavaScript code

  • This could be implemented without emitting different JS based on the types of the expressions

  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)

  • This feature would agree with the rest of TypeScript's Design Goals.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Es werden keine Quelldateien oder Tests genannt. Beginne damit, das bereitgestellte JavaScript-Beispiel mit tsc zu reproduzieren und nachzuverfolgen, wie JSDoc @augments/@extends für typedefs behandelt wird; fertig ist die Arbeit, wenn object typedefs diese Tags ohne die gemeldete Diagnose akzeptieren und den beabsichtigten zusammengeführten Typ erzeugen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.