Skip to content

Commit 5dc1782

Browse files
committed
Small error message change
1 parent 74e9f9f commit 5dc1782

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11373,7 +11373,7 @@ namespace ts {
1137311373
result = true;
1137411374
error(
1137511375
containingElement.openingElement.tagName,
11376-
Diagnostics.Target_JSX_element_expects_0_prop_of_type_1_but_multiple_children_were_provided,
11376+
Diagnostics.Target_JSX_element_expects_a_0_prop_of_type_1_but_multiple_children_were_provided,
1137711377
childPropName ? unescapeLeadingUnderscores(childPropName) : "children",
1137811378
typeToString(childrenTargetType)
1137911379
);
@@ -11397,7 +11397,7 @@ namespace ts {
1139711397
result = true;
1139811398
error(
1139911399
containingElement.openingElement.tagName,
11400-
Diagnostics.Target_JSX_element_expects_0_prop_of_type_1_but_only_a_single_child_was_provided,
11400+
Diagnostics.Target_JSX_element_expects_a_0_prop_of_type_1_but_only_a_single_child_was_provided,
1140111401
childPropName ? unescapeLeadingUnderscores(childPropName) : "children",
1140211402
typeToString(childrenTargetType)
1140311403
);

src/compiler/diagnosticMessages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,11 +2541,11 @@
25412541
"category": "Error",
25422542
"code": 2744
25432543
},
2544-
"Target JSX element expects {0} prop of type {1}, but only a single child was provided.": {
2544+
"Target JSX element expects a '{0}' prop of type '{1}', but only a single child was provided.": {
25452545
"category": "Error",
25462546
"code": 2745
25472547
},
2548-
"Target JSX element expects {0} prop of type {1}, but multiple children were provided.": {
2548+
"Target JSX element expects a '{0}' prop of type '{1}', but multiple children were provided.": {
25492549
"category": "Error",
25502550
"code": 2746
25512551
},

tests/baselines/reference/checkJsxChildrenProperty14.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tests/cases/conformance/jsx/file.tsx(42,11): error TS2746: Target JSX element expects children prop of type Element, but multiple children were provided.
1+
tests/cases/conformance/jsx/file.tsx(42,11): error TS2746: Target JSX element expects a 'children' prop of type 'Element', but multiple children were provided.
22

33

44
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
@@ -45,4 +45,4 @@ tests/cases/conformance/jsx/file.tsx(42,11): error TS2746: Target JSX element ex
4545
// Error
4646
let k5 = <SingleChildComp a={10} b="hi"><></><Button /><AnotherButton /></SingleChildComp>;
4747
~~~~~~~~~~~~~~~
48-
!!! error TS2746: Target JSX element expects children prop of type Element, but multiple children were provided.
48+
!!! error TS2746: Target JSX element expects a 'children' prop of type 'Element', but multiple children were provided.

tests/baselines/reference/checkJsxChildrenProperty2.errors.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
tests/cases/conformance/jsx/file.tsx(14,10): error TS2741: Property 'children' is missing in type '{ a: number; b: string; }' but required in type 'Prop'.
22
tests/cases/conformance/jsx/file.tsx(17,11): error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten.
3-
tests/cases/conformance/jsx/file.tsx(31,6): error TS2746: Target JSX element expects children prop of type string | Element, but multiple children were provided.
4-
tests/cases/conformance/jsx/file.tsx(37,6): error TS2746: Target JSX element expects children prop of type string | Element, but multiple children were provided.
5-
tests/cases/conformance/jsx/file.tsx(43,6): error TS2746: Target JSX element expects children prop of type string | Element, but multiple children were provided.
6-
tests/cases/conformance/jsx/file.tsx(49,6): error TS2746: Target JSX element expects children prop of type string | Element, but multiple children were provided.
3+
tests/cases/conformance/jsx/file.tsx(31,6): error TS2746: Target JSX element expects a 'children' prop of type 'string | Element', but multiple children were provided.
4+
tests/cases/conformance/jsx/file.tsx(37,6): error TS2746: Target JSX element expects a 'children' prop of type 'string | Element', but multiple children were provided.
5+
tests/cases/conformance/jsx/file.tsx(43,6): error TS2746: Target JSX element expects a 'children' prop of type 'string | Element', but multiple children were provided.
6+
tests/cases/conformance/jsx/file.tsx(49,6): error TS2746: Target JSX element expects a 'children' prop of type 'string | Element', but multiple children were provided.
77

88

99
==== tests/cases/conformance/jsx/file.tsx (6 errors) ====
@@ -44,31 +44,31 @@ tests/cases/conformance/jsx/file.tsx(49,6): error TS2746: Target JSX element exp
4444
let k2 =
4545
<Comp a={10} b="hi">
4646
~~~~
47-
!!! error TS2746: Target JSX element expects children prop of type string | Element, but multiple children were provided.
47+
!!! error TS2746: Target JSX element expects a 'children' prop of type 'string | Element', but multiple children were provided.
4848
<div> My Div </div>
4949
{(name: string) => <div> My name {name} </div>}
5050
</Comp>;
5151

5252
let k3 =
5353
<Comp a={10} b="hi">
5454
~~~~
55-
!!! error TS2746: Target JSX element expects children prop of type string | Element, but multiple children were provided.
55+
!!! error TS2746: Target JSX element expects a 'children' prop of type 'string | Element', but multiple children were provided.
5656
<div> My Div </div>
5757
{1000000}
5858
</Comp>;
5959

6060
let k4 =
6161
<Comp a={10} b="hi" >
6262
~~~~
63-
!!! error TS2746: Target JSX element expects children prop of type string | Element, but multiple children were provided.
63+
!!! error TS2746: Target JSX element expects a 'children' prop of type 'string | Element', but multiple children were provided.
6464
<div> My Div </div>
6565
hi hi hi!
6666
</Comp>;
6767

6868
let k5 =
6969
<Comp a={10} b="hi" >
7070
~~~~
71-
!!! error TS2746: Target JSX element expects children prop of type string | Element, but multiple children were provided.
71+
!!! error TS2746: Target JSX element expects a 'children' prop of type 'string | Element', but multiple children were provided.
7272
<div> My Div </div>
7373
<div> My Div </div>
7474
</Comp>;

tests/baselines/reference/jsxChildrenIndividualErrorElaborations.errors.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
tests/cases/compiler/index.tsx(14,9): error TS2322: Type 'number' is not assignable to type 'string'.
22
tests/cases/compiler/index.tsx(18,15): error TS2322: Type 'string' is not assignable to type '(x: number) => string'.
3-
tests/cases/compiler/index.tsx(23,10): error TS2746: Target JSX element expects children prop of type (x: number) => string, but multiple children were provided.
4-
tests/cases/compiler/index.tsx(37,10): error TS2745: Target JSX element expects children prop of type ((x: number) => string)[], but only a single child was provided.
5-
tests/cases/compiler/index.tsx(42,10): error TS2745: Target JSX element expects children prop of type ((x: number) => string)[], but only a single child was provided.
3+
tests/cases/compiler/index.tsx(23,10): error TS2746: Target JSX element expects a 'children' prop of type '(x: number) => string', but multiple children were provided.
4+
tests/cases/compiler/index.tsx(37,10): error TS2745: Target JSX element expects a 'children' prop of type '((x: number) => string)[]', but only a single child was provided.
5+
tests/cases/compiler/index.tsx(42,10): error TS2745: Target JSX element expects a 'children' prop of type '((x: number) => string)[]', but only a single child was provided.
66
tests/cases/compiler/index.tsx(48,9): error TS2322: Type 'number' is not assignable to type 'string'.
77
tests/cases/compiler/index.tsx(49,9): error TS2322: Type 'number' is not assignable to type 'string'.
88
tests/cases/compiler/index.tsx(63,3): error TS2322: Type '(x: number) => number' is not assignable to type 'Cb | Cb[]'.
@@ -46,7 +46,7 @@ tests/cases/compiler/index.tsx(74,9): error TS2322: Type 'number' is not assigna
4646
// Blah components don't accept multiple children.
4747
var a = <Blah>
4848
~~~~
49-
!!! error TS2746: Target JSX element expects children prop of type (x: number) => string, but multiple children were provided.
49+
!!! error TS2746: Target JSX element expects a 'children' prop of type '(x: number) => string', but multiple children were provided.
5050
{x => "" + x}
5151
{x => "" + x}
5252
</Blah>
@@ -62,14 +62,14 @@ tests/cases/compiler/index.tsx(74,9): error TS2322: Type 'number' is not assigna
6262
// Incompatible child.
6363
var a = <Blah2>
6464
~~~~~
65-
!!! error TS2745: Target JSX element expects children prop of type ((x: number) => string)[], but only a single child was provided.
65+
!!! error TS2745: Target JSX element expects a 'children' prop of type '((x: number) => string)[]', but only a single child was provided.
6666
{x => x}
6767
</Blah2>
6868

6969
// Blah2 components don't accept text as child elements
7070
var a = <Blah2>
7171
~~~~~
72-
!!! error TS2745: Target JSX element expects children prop of type ((x: number) => string)[], but only a single child was provided.
72+
!!! error TS2745: Target JSX element expects a 'children' prop of type '((x: number) => string)[]', but only a single child was provided.
7373
Hello unexpected text!
7474
</Blah2>
7575

0 commit comments

Comments
 (0)