microsoft / microsoft/TypeScript

Error elaborations should not be de-duped

Offen
#33,143 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

TypeScript Version: 3.5.1

Search Terms:

  • Error message different

Code

interface ExprData {
  mapper : () => unknown,
  blah : string,
}
interface Expr<DataT extends ExprData> {
  mapper : DataT["mapper"],
  blah : DataT["blah"],

  extra : number,
}

declare function where (
  callback : () => Expr<{
    mapper : () => boolean,
    blah : string,
  }>
) : void;

declare function getInvalidWhere () : Expr<{
  mapper : () => (boolean|null),
  blah : string,
}>;

/*
Type 'Expr<{ mapper: () => boolean | null; blah: string; }>' is not assignable to type 'Expr<{ mapper: () => boolean; blah: string; }>'.
  Type '{ mapper: () => boolean | null; blah: string; }' is not assignable to type '{ mapper: () => boolean; blah: string; }'.
    Types of property 'mapper' are incompatible.
      Type '() => boolean | null' is not assignable to type '() => boolean'.
        Type 'boolean | null' is not assignable to type 'boolean'.
          Type 'null' is not assignable to type 'boolean'.
*/
where(() => getInvalidWhere())
/*
  Expected: Same error as above,
  Actual:
    Type 'Expr<{ mapper: () => boolean | null; blah: string; }>' is not assignable to type
    'Expr<{ mapper: () => boolean; blah: string; }>'.
*/
where(() => getInvalidWhere())

Expected behavior:

  • Both errors should have the same error message, if they're in the same file.
  • Both errors should have the same error message, if they're in different files.

Actual behavior:

  • Both errors have different error messages in the same file.
  • Both errors have different error messages in different files.

Playground Link:

Playground

Related Issues:

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 wird keine Quelldatei und kein Test genannt. Beginne damit, die beiden Aufrufe im bereitgestellten TypeScript-Beispiel zu reproduzieren und die Diagnosen aus dem Playground oder einem lokalen Compiler zu vergleichen, und verfolge dann den Pfad der Fehleraufbereitung und -deduplizierung des Compilers. Als abgeschlossen gilt die Arbeit, wenn wiederholte Aufbereitungen in den Fällen mit derselben Datei und mit unterschiedlichen Dateien dieselbe vollständige Meldung beibehalten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
compilers
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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