|
| 1 | +tests/cases/conformance/jsx/file.tsx(14,15): error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'IntrinsicAttributes & Prop'. |
| 2 | + Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'. |
| 3 | + Property 'children' is missing in type '{ a: 10; b: "hi"; }'. |
| 4 | +tests/cases/conformance/jsx/file.tsx(17,11): error TS2708: props.children are specified twice. The attribute named 'children' will be overwritten. |
| 5 | +tests/cases/conformance/jsx/file.tsx(23,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'IntrinsicAttributes & Prop'. |
| 6 | + Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'Prop'. |
| 7 | + Types of property 'children' are incompatible. |
| 8 | + Type '(Element | ((name: string) => Element))[]' is not assignable to type 'string | Element'. |
| 9 | + Type '(Element | ((name: string) => Element))[]' is not assignable to type 'Element'. |
| 10 | + Property 'type' is missing in type '(Element | ((name: string) => Element))[]'. |
| 11 | +tests/cases/conformance/jsx/file.tsx(29,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'. |
| 12 | + Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'Prop'. |
| 13 | + Types of property 'children' are incompatible. |
| 14 | + Type '(Element | 1000000)[]' is not assignable to type 'string | Element'. |
| 15 | + Type '(Element | 1000000)[]' is not assignable to type 'Element'. |
| 16 | + Property 'type' is missing in type '(Element | 1000000)[]'. |
| 17 | +tests/cases/conformance/jsx/file.tsx(35,11): error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'. |
| 18 | + Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'. |
| 19 | + Types of property 'children' are incompatible. |
| 20 | + Type '(string | Element)[]' is not assignable to type 'string | Element'. |
| 21 | + Type '(string | Element)[]' is not assignable to type 'Element'. |
| 22 | + Property 'type' is missing in type '(string | Element)[]'. |
| 23 | +tests/cases/conformance/jsx/file.tsx(41,11): error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & Prop'. |
| 24 | + Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'Prop'. |
| 25 | + Types of property 'children' are incompatible. |
| 26 | + Type 'Element[]' is not assignable to type 'string | Element'. |
| 27 | + Type 'Element[]' is not assignable to type 'Element'. |
| 28 | + Property 'type' is missing in type 'Element[]'. |
| 29 | + |
| 30 | + |
| 31 | +==== tests/cases/conformance/jsx/file.tsx (6 errors) ==== |
| 32 | + import React = require('react'); |
| 33 | + |
| 34 | + interface Prop { |
| 35 | + a: number, |
| 36 | + b: string, |
| 37 | + children: string | JSX.Element |
| 38 | + } |
| 39 | + |
| 40 | + function Comp(p: Prop) { |
| 41 | + return <div>{p.b}</div>; |
| 42 | + } |
| 43 | + |
| 44 | + // Error: missing children |
| 45 | + let k = <Comp a={10} b="hi" />; |
| 46 | + ~~~~~~~~~~~~~ |
| 47 | +!!! error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'IntrinsicAttributes & Prop'. |
| 48 | +!!! error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'. |
| 49 | +!!! error TS2322: Property 'children' is missing in type '{ a: 10; b: "hi"; }'. |
| 50 | + |
| 51 | + let k1 = |
| 52 | + <Comp a={10} b="hi" children="Random" > |
| 53 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 54 | +!!! error TS2708: props.children are specified twice. The attribute named 'children' will be overwritten. |
| 55 | + hi hi hi! |
| 56 | + </Comp>; |
| 57 | + |
| 58 | + // Error: incorrect type |
| 59 | + let k2 = |
| 60 | + <Comp a={10} b="hi"> |
| 61 | + ~~~~~~~~~~~~~ |
| 62 | +!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'IntrinsicAttributes & Prop'. |
| 63 | +!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'Prop'. |
| 64 | +!!! error TS2322: Types of property 'children' are incompatible. |
| 65 | +!!! error TS2322: Type '(Element | ((name: string) => Element))[]' is not assignable to type 'string | Element'. |
| 66 | +!!! error TS2322: Type '(Element | ((name: string) => Element))[]' is not assignable to type 'Element'. |
| 67 | +!!! error TS2322: Property 'type' is missing in type '(Element | ((name: string) => Element))[]'. |
| 68 | + <div> My Div </div> |
| 69 | + {(name: string) => <div> My name {name} </div>} |
| 70 | + </Comp>; |
| 71 | + |
| 72 | + let k3 = |
| 73 | + <Comp a={10} b="hi"> |
| 74 | + ~~~~~~~~~~~~~ |
| 75 | +!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'. |
| 76 | +!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'Prop'. |
| 77 | +!!! error TS2322: Types of property 'children' are incompatible. |
| 78 | +!!! error TS2322: Type '(Element | 1000000)[]' is not assignable to type 'string | Element'. |
| 79 | +!!! error TS2322: Type '(Element | 1000000)[]' is not assignable to type 'Element'. |
| 80 | +!!! error TS2322: Property 'type' is missing in type '(Element | 1000000)[]'. |
| 81 | + <div> My Div </div> |
| 82 | + {1000000} |
| 83 | + </Comp>; |
| 84 | + |
| 85 | + let k4 = |
| 86 | + <Comp a={10} b="hi" > |
| 87 | + ~~~~~~~~~~~~~ |
| 88 | +!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'. |
| 89 | +!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'. |
| 90 | +!!! error TS2322: Types of property 'children' are incompatible. |
| 91 | +!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'string | Element'. |
| 92 | +!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element'. |
| 93 | +!!! error TS2322: Property 'type' is missing in type '(string | Element)[]'. |
| 94 | + <div> My Div </div> |
| 95 | + hi hi hi! |
| 96 | + </Comp>; |
| 97 | + |
| 98 | + let k5 = |
| 99 | + <Comp a={10} b="hi" > |
| 100 | + ~~~~~~~~~~~~~ |
| 101 | +!!! error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & Prop'. |
| 102 | +!!! error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'Prop'. |
| 103 | +!!! error TS2322: Types of property 'children' are incompatible. |
| 104 | +!!! error TS2322: Type 'Element[]' is not assignable to type 'string | Element'. |
| 105 | +!!! error TS2322: Type 'Element[]' is not assignable to type 'Element'. |
| 106 | +!!! error TS2322: Property 'type' is missing in type 'Element[]'. |
| 107 | + <div> My Div </div> |
| 108 | + <div> My Div </div> |
| 109 | + </Comp>; |
0 commit comments