microsoft / microsoft/TypeScript
Specialize JSX error messages for missing properties
Open
@weswigham is already working on this.
Since Jul 25, 2020.
Domain: Error Messages
Domain: JSX/TSX
Effort: Moderate
Experience Enhancement
Help Wanted
Rescheduled
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.