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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
tests/cases/conformance/jsx/file.tsx(16,26): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(18,26): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(20,13): error TS2558: Expected 1 type arguments, but got 2.
tests/cases/conformance/jsx/file.tsx(22,13): error TS2558: Expected 1 type arguments, but got 2.
tests/cases/conformance/jsx/file.tsx(24,12): error TS1099: Type argument list cannot be empty.
tests/cases/conformance/jsx/file.tsx(24,13): error TS2558: Expected 1 type arguments, but got 0.
tests/cases/conformance/jsx/file.tsx(26,12): error TS1099: Type argument list cannot be empty.
tests/cases/conformance/jsx/file.tsx(26,13): error TS2558: Expected 1 type arguments, but got 0.
tests/cases/conformance/jsx/file.tsx(39,14): error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'.
Types of property 'a' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(41,14): error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'.
tests/cases/conformance/jsx/file.tsx(47,14): error TS2558: Expected 1-2 type arguments, but got 3.
tests/cases/conformance/jsx/file.tsx(49,14): error TS2558: Expected 1-2 type arguments, but got 3.
tests/cases/conformance/jsx/file.tsx(51,47): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsx/file.tsx(53,47): error TS2322: Type 'string' is not assignable to type 'number'.
==== tests/cases/conformance/jsx/file.tsx (14 errors) ====
import React = require('react');
interface Prop {
a: number,
b: string
}
declare class MyComp<P> extends React.Component<P, {}> {
internalProp: P;
}
let x = <MyComp<Prop> a={10} b="hi" />; // OK
x = <MyComp<Prop> a={10} b="hi"></MyComp>; // OK
x = <MyComp<Prop> a={10} b={20} />; // error
~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<Prop>> & Prop & { children?: ReactNode; }'
x = <MyComp<Prop> a={10} b={20}></MyComp>; // error
~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<Prop>> & Prop & { children?: ReactNode; }'
x = <MyComp<Prop, Prop> a={10} b="hi" />; // error
~~~~~~~~~~
!!! error TS2558: Expected 1 type arguments, but got 2.
x = <MyComp<Prop, Prop> a={10} b="hi"></MyComp>; // error
~~~~~~~~~~
!!! error TS2558: Expected 1 type arguments, but got 2.
x = <MyComp<> a={10} b="hi" />; // error
~~
!!! error TS1099: Type argument list cannot be empty.
!!! error TS2558: Expected 1 type arguments, but got 0.
x = <MyComp<> a={10} b="hi"></MyComp>; // error
~~
!!! error TS1099: Type argument list cannot be empty.
!!! error TS2558: Expected 1 type arguments, but got 0.
x= <MyComp<{}> /> // OK
x= <MyComp<{}>></MyComp> // OK
declare class MyComp2<P extends { a: string }, P2 = {}> extends React.Component<P & P2, {}> {
internalProp: [P, P2];
}
x = <MyComp2<{a: string, b: string}> a="a" b="b" />; // OK
x = <MyComp2<{a: string, b: string}> a="a" b="b"></MyComp2>; // OK
x = <MyComp2<Prop> a={10} b="hi" />; // error
~~~~
!!! error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'.
!!! error TS2344: Types of property 'a' are incompatible.
!!! error TS2344: Type 'number' is not assignable to type 'string'.
x = <MyComp2<Prop> a={10} b="hi"></MyComp2>; // error
~~~~
!!! error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'.
x = <MyComp2<{a: string}, {b: string}> a="hi" b="hi" />; // OK
x = <MyComp2<{a: string}, {b: string}> a="hi" b="hi"></MyComp2>; // OK
x = <MyComp2<{a: string}, {b: string}, Prop> a="hi" b="hi" />; // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 1-2 type arguments, but got 3.
x = <MyComp2<{a: string}, {b: string}, Prop> a="hi" b="hi"></MyComp2>; // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 1-2 type arguments, but got 3.
x = <MyComp2<{a: string}, {b: number}> a="hi" b="hi" />; // error
~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:51:28: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, { b: number; }>> & { a: string; } & { b: number; } & { children?: ReactNode; }'
x = <MyComp2<{a: string}, {b: number}> a="hi" b="hi"></MyComp2>; // error
~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:53:28: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, { b: number; }>> & { a: string; } & { b: number; } & { children?: ReactNode; }'
|