mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
49 lines
2.1 KiB
Plaintext
49 lines
2.1 KiB
Plaintext
file.tsx(22,10): error TS2741: Property 'children' is missing in type '{ a: number; b: string; }' but required in type 'Prop'.
|
|
file.tsx(27,9): error TS2322: Type 'Element' is not assignable to type 'Button'.
|
|
Type 'ReactElement<any>' is missing the following properties from type 'Button': render, setState, forceUpdate, state, and 2 more.
|
|
file.tsx(31,10): error TS2740: Type 'typeof Button' is missing the following properties from type 'Button': render, setState, forceUpdate, props, and 3 more.
|
|
|
|
|
|
==== file.tsx (3 errors) ====
|
|
/// <reference path="/.lib/react.d.ts" />
|
|
|
|
import React = require('react');
|
|
|
|
interface Prop {
|
|
a: number,
|
|
b: string,
|
|
children: Button;
|
|
}
|
|
|
|
class Button extends React.Component<any, any> {
|
|
render() {
|
|
return (<div>My Button</div>)
|
|
}
|
|
}
|
|
|
|
function Comp(p: Prop) {
|
|
return <div>{p.b}</div>;
|
|
}
|
|
|
|
// Error: no children specified
|
|
let k = <Comp a={10} b="hi" />;
|
|
~~~~
|
|
!!! error TS2741: Property 'children' is missing in type '{ a: number; b: string; }' but required in type 'Prop'.
|
|
!!! related TS2728 file.tsx:8:5: 'children' is declared here.
|
|
|
|
// Error: JSX.element is not the same as JSX.ElementClass
|
|
let k1 =
|
|
<Comp a={10} b="hi">
|
|
<Button />
|
|
~~~~~~~~~~
|
|
!!! error TS2322: Type 'Element' is not assignable to type 'Button'.
|
|
!!! error TS2322: Type 'ReactElement<any>' is missing the following properties from type 'Button': render, setState, forceUpdate, state, and 2 more.
|
|
!!! related TS6500 file.tsx:8:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & Prop'
|
|
</Comp>;
|
|
let k2 =
|
|
<Comp a={10} b="hi">
|
|
{Button}
|
|
~~~~~~
|
|
!!! error TS2740: Type 'typeof Button' is missing the following properties from type 'Button': render, setState, forceUpdate, props, and 3 more.
|
|
!!! related TS6213 file.tsx:31:10: Did you mean to use 'new' with this expression?
|
|
</Comp>; |