microsoft / microsoft/TypeScript

Error output: difficult to understand multistorey errors

Aperta
#26,996 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Needs Proposal Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

Incompatible type
var foo = {a: {b: {c: {d: 3}}}};
var bar: {a: {b: {c: {d: {e: number}}}}} = foo;

Instead of

Type '{ a: { b: { c: { d: number; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: number; }; }; }; }; }'.
  Types of property 'a' are incompatible.
    Type '{ b: { c: { d: number; }; }; }' is not assignable to type '{ b: { c: { d: { e: number; }; }; }; }'.
      Types of property 'b' are incompatible.
        Type '{ c: { d: number; }; }' is not assignable to type '{ c: { d: { e: number; }; }; }'.
          Types of property 'c' are incompatible.
            Type '{ d: number; }' is not assignable to type '{ d: { e: number; }; }'.
              Types of property 'd' are incompatible.
                Type 'number' is not assignable to type '{ e: number; }'.

Print something like that

Type '{ a: { b: { c: { d: number; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: number; }; }; }; }; }'.
  Property 'a.b.c.d: number' is not assignable to 'a.b.c.d: {...}'
Missing property
var foo = {a: {b: {c: {d: 3}}}};
var bar: {a: {b: {c: {d: number, e: number}}}} = foo;
Type '{ a: { b: { c: { d: number; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: number; e: number; }; }; }; }'.
  Types of property 'a' are incompatible.
    Type '{ b: { c: { d: number; }; }; }' is not assignable to type '{ b: { c: { d: number; e: number; }; }; }'.
      Types of property 'b' are incompatible.
        Type '{ c: { d: number; }; }' is not assignable to type '{ c: { d: number; e: number; }; }'.
          Types of property 'c' are incompatible.
            Type '{ d: number; }' is not assignable to type '{ d: number; e: number; }'.
              Property 'e' is missing in type '{ d: number; }'.

vs

Type '{ a: { b: { c: { d: number; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: number; e: number; }; }; }; }'.
  Property 'a.b.c.e: number' is missing
Incompatible function parameter
var foo = {a: {b: {c: {d(y: number, x: string, z: number) {}}}}};
var bar: {a: {b: {c: {d(y: number, x: number, z: number):void}}}} = foo;
Type '{ a: { b: { c: { d(y: number, x: string, z: number): void; }; }; }; }' is not assignable to type '{ a: { b: { c: { d(y: number, x: number, z: number): void; }; }; }; }'.
    Parameter 'a.b.c.d(...,x: string,...)' is not compatible to 'a.b.c.d(...,x: number,...)'
Incompatible function return
var foo = {a: {b: {c: {d(x: number) {}}}}};
var bar: {a: {b: {c: {d(x: number):Date}}}} = foo;
Type '{ a: { b: { c: { d(x: number): void; }; }; }; }' is not assignable to type '{ a: { b: { c: { d(x: number): Date; }; }; }; }'.      
   Return type of 'a.b.c.d(...): void' is not compatible to 'a.b.c.d(...): Date'

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Inizia con gli esempi incompatible-type, missing-property, incompatible-parameter e incompatible-return nell’issue. Traccia il modo in cui TypeScript formatta attualmente queste diagnostiche annidate, quindi confronta l’output con il formato del percorso della proprietà richiesto; il lavoro è completo quando gli esempi riportano percorsi concisi preservando i dettagli rilevanti dell’incompatibilità.

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

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.