Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/checker/jsx.go
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,10 @@ func (c *Checker) getJsxElementPropertiesName(jsxNamespace *ast.Symbol) string {
}

func (c *Checker) getJsxElementChildrenPropertyName(jsxNamespace *ast.Symbol) string {
if c.compilerOptions.Jsx == core.JsxEmitReactJSX || c.compilerOptions.Jsx == core.JsxEmitReactJSXDev {
// In these JsxEmit modes the children property is fixed to 'children'
return "children"
}
return c.getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/test.tsx(1,49): error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
/test.tsx(3,2): error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
/test.tsx(5,50): error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
/test.tsx(7,2): error TS2741: Property 'offspring' is missing in type '{ children: string; }' but required in type '{ offspring: string; }'.


==== /jsx.d.ts (0 errors) ====
Expand All @@ -16,23 +14,17 @@
}
}

==== /test.tsx (3 errors) ====
==== /test.tsx (1 errors) ====
const Title = (props: { children: string }) => <h1>{props.children}</h1>;
~~
!!! error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
!!! related TS2728 /jsx.d.ts:3:11: 'children' is declared here.

<Title>Hello, world!</Title>;
~~~~~
!!! error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
!!! related TS2728 /test.tsx:1:25: 'children' is declared here.

const Wrong = (props: { offspring: string }) => <h1>{props.offspring}</h1>;
~~
!!! error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
!!! related TS2728 /jsx.d.ts:3:11: 'children' is declared here.

<Wrong>Byebye, world!</Wrong>
~~~~~
!!! error TS2741: Property 'offspring' is missing in type '{ children: string; }' but required in type '{ offspring: string; }'.
!!! related TS2728 /test.tsx:5:25: 'offspring' is declared here.

==== /jsx/jsx-runtime.ts (0 errors) ====
export {};
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/test.tsx(1,49): error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
/test.tsx(3,2): error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
/test.tsx(5,50): error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
/test.tsx(7,2): error TS2741: Property 'offspring' is missing in type '{ children: string; }' but required in type '{ offspring: string; }'.


==== /jsx.d.ts (0 errors) ====
Expand All @@ -16,23 +14,17 @@
}
}

==== /test.tsx (3 errors) ====
==== /test.tsx (1 errors) ====
const Title = (props: { children: string }) => <h1>{props.children}</h1>;
~~
!!! error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
!!! related TS2728 /jsx.d.ts:3:11: 'children' is declared here.

<Title>Hello, world!</Title>;
~~~~~
!!! error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
!!! related TS2728 /test.tsx:1:25: 'children' is declared here.

const Wrong = (props: { offspring: string }) => <h1>{props.offspring}</h1>;
~~
!!! error TS2741: Property 'children' is missing in type '{ offspring: string; }' but required in type '{ children: string; }'.
!!! related TS2728 /jsx.d.ts:3:11: 'children' is declared here.

<Wrong>Byebye, world!</Wrong>
~~~~~
!!! error TS2741: Property 'offspring' is missing in type '{ children: string; }' but required in type '{ offspring: string; }'.
!!! related TS2728 /test.tsx:5:25: 'offspring' is declared here.

==== /jsx/jsx-runtime.ts (0 errors) ====
export {};
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.