Microsoft/TypeScript

Specialize JSX error messages for missing properties

开放

#39,749 创建于 2020年7月25日

 (0 条评论) (0 个反应) (1 位负责人)TypeScript (13,395 个派生)batch import
Domain: Error MessagesDomain: JSX/TSXEffort: ModerateExperience EnhancementHelp WantedRescheduled

仓库指标

星标
 (108,860 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南