Skip to content

Commit dbac3e7

Browse files
Update Baselines and/or Applied Lint Fixes
1 parent 0815afd commit dbac3e7

16 files changed

+622
-0
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx(17,12): error TS2792: Cannot find module 'react/jsx-runtime'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?
2+
tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx(21,9): error TS2609: JSX spread child must be an array type.
3+
4+
5+
==== tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx (2 errors) ====
6+
declare module JSX {
7+
interface Element { }
8+
interface IntrinsicElements {
9+
[s: string]: any;
10+
}
11+
}
12+
declare var React: any;
13+
14+
interface TodoProp {
15+
id: number;
16+
todo: string;
17+
}
18+
interface TodoListProps {
19+
todos: TodoProp[];
20+
}
21+
function Todo(prop: { key: number, todo: string }) {
22+
return <div>{prop.key.toString() + prop.todo}</div>;
23+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24+
!!! error TS2792: Cannot find module 'react/jsx-runtime'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?
25+
}
26+
function TodoList({ todos }: TodoListProps) {
27+
return <div>
28+
{...<Todo key={todos[0].id} todo={todos[0].todo} />}
29+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30+
!!! error TS2609: JSX spread child must be an array type.
31+
</div>;
32+
}
33+
function TodoListNoError({ todos }: TodoListProps) {
34+
// any is not checked
35+
return <div>
36+
{...(<Todo key={todos[0].id} todo={todos[0].todo} /> as any)}
37+
</div>;
38+
}
39+
let x: TodoListProps;
40+
<TodoList {...x}/>
41+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//// [tsxSpreadChildrenInvalidType.tsx]
2+
declare module JSX {
3+
interface Element { }
4+
interface IntrinsicElements {
5+
[s: string]: any;
6+
}
7+
}
8+
declare var React: any;
9+
10+
interface TodoProp {
11+
id: number;
12+
todo: string;
13+
}
14+
interface TodoListProps {
15+
todos: TodoProp[];
16+
}
17+
function Todo(prop: { key: number, todo: string }) {
18+
return <div>{prop.key.toString() + prop.todo}</div>;
19+
}
20+
function TodoList({ todos }: TodoListProps) {
21+
return <div>
22+
{...<Todo key={todos[0].id} todo={todos[0].todo} />}
23+
</div>;
24+
}
25+
function TodoListNoError({ todos }: TodoListProps) {
26+
// any is not checked
27+
return <div>
28+
{...(<Todo key={todos[0].id} todo={todos[0].todo} /> as any)}
29+
</div>;
30+
}
31+
let x: TodoListProps;
32+
<TodoList {...x}/>
33+
34+
35+
//// [tsxSpreadChildrenInvalidType.js]
36+
function Todo(prop) {
37+
return _jsx("div", { children: prop.key.toString() + prop.todo }, void 0);
38+
}
39+
function TodoList({ todos }) {
40+
return _jsxs("div", { children: [..._jsx(Todo, { todo: todos[0].todo }, todos[0].id)] }, void 0);
41+
}
42+
function TodoListNoError({ todos }) {
43+
// any is not checked
44+
return _jsxs("div", { children: [..._jsx(Todo, { todo: todos[0].todo }, todos[0].id)] }, void 0);
45+
}
46+
let x;
47+
_jsx(TodoList, Object.assign({}, x), void 0);

0 commit comments

Comments
 (0)