mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
65 lines
2.1 KiB
Plaintext
65 lines
2.1 KiB
Plaintext
file.tsx(26,28): error TS2551: Property 'NAme' does not exist on type 'IUser'. Did you mean 'Name'?
|
|
file.tsx(38,15): error TS2322: Type '(user: IUser) => Element' is not assignable to type 'boolean | any[] | ReactChild'.
|
|
file.tsx(41,15): error TS2322: Type '(user: IUser) => Element' is not assignable to type 'boolean | any[] | ReactChild'.
|
|
|
|
|
|
==== file.tsx (3 errors) ====
|
|
/// <reference path="/.lib/react.d.ts" />
|
|
|
|
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 file.tsx:6: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 file.tsx:38: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 file.tsx:41:15: Did you mean to call this expression?
|
|
</FetchUser>
|
|
);
|
|
} |