Microsoft/TypeScript

Specialize JSX error messages for missing properties

Open

#39.749 geöffnet am 25. Juli 2020

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (1 zugewiesene Person)TypeScript (6.726 Forks)batch import
Domain: Error MessagesDomain: JSX/TSXEffort: ModerateExperience EnhancementFix AvailableHelp WantedRescheduled

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

import React from "react";

function Foo(props: { count: number }) {
    return <div>{props.count}</div>;
}

<Foo />

function Bar(props: { a: any, b: any }) {
    return <div />;
}

<Bar />

function Baz(props: { a: any, b: any, c: any, d: any, e: any, f: any }) {
    return <div />
}

<Baz />

Current

Property 'count' is missing in type '{}' but required in type '{ count: number; }'.
Type '{}' is missing the following properties from type '{ a: any; b: any; }': a, b
Type '{}' is missing the following properties from type '{ a: any; b: any; c: any; d: any; e: any; f: any; }': a, b, c, d, and 2 more.

Proposed

The 'count' attribute is missing, but is required for this 'Foo' tag.
This 'Bar' tag is missing the following attributes: a, b.
This 'Baz' tag is missing the following attributes: a, b, c, d, and 2 more.

Playground Link

Contributor Guide