/
checkJsxChildrenProperty4.errors.txt
63 lines (53 loc) · 2.24 KB
/
checkJsxChildrenProperty4.errors.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
tests/cases/conformance/jsx/file.tsx(24,28): error TS2551: Property 'NAme' does not exist on type 'IUser'. Did you mean 'Name'?
tests/cases/conformance/jsx/file.tsx(36,15): error TS2322: Type '(user: IUser) => Element' is not assignable to type 'boolean | any[] | ReactChild'.
tests/cases/conformance/jsx/file.tsx(39,15): error TS2322: Type '(user: IUser) => Element' is not assignable to type 'boolean | any[] | ReactChild'.
==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
import React = require('react');
interface IUser {
Name: string;
}
interface IFetchUserProps {
children: (user: IUser) => JSX.Element;
}
class FetchUser extends React.Component<IFetchUserProps, any> {
render() {
return this.state
? this.props.children(this.state.result)
: null;
}
}
// Error
function UserName() {
return (
<FetchUser>
{ user => (
<h1>{ user.NAme }</h1>
~~~~
!!! error TS2551: Property 'NAme' does not exist on type 'IUser'. Did you mean 'Name'?
!!! related TS2728 tests/cases/conformance/jsx/file.tsx:4:5: 'Name' is declared here.
) }
</FetchUser>
);
}
function UserName1() {
return (
<FetchUser>
{ user => (
~~~~~~~~~
<h1>{ user.Name }</h1>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
) }
~~~~~~~~~~~~~
!!! error TS2322: Type '(user: IUser) => Element' is not assignable to type 'boolean | any[] | ReactChild'.
!!! related TS6212 tests/cases/conformance/jsx/file.tsx:36:15: Did you mean to call this expression?
{ user => (
~~~~~~~~~
<h1>{ user.Name }</h1>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
) }
~~~~~~~~~~~~~
!!! error TS2322: Type '(user: IUser) => Element' is not assignable to type 'boolean | any[] | ReactChild'.
!!! related TS6212 tests/cases/conformance/jsx/file.tsx:39:15: Did you mean to call this expression?
</FetchUser>
);
}