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
|
tests/cases/conformance/jsx/file.tsx(32,17): error TS2322: Type 'string' is not assignable to type 'never'.
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
import React = require('react');
class RC1 extends React.Component<{x : number}, {}> {
render() {
return null;
}
}
class RC2 extends React.Component<{ x: string }, {}> {
render() {
return null;
}
private method() { }
}
class RC3 extends React.Component<{}, {}> {
render() {
return null;
}
}
class RC4 extends React.Component<{}, {}> {
render() {
return null;
}
}
var EmptyRCComp = RC3 || RC4;
var PartRCComp = RC1 || RC4;
var RCComp = RC1 || RC2;
// OK
let a = <RCComp x="Hi" />;
~
!!! error TS2322: Type 'string' is not assignable to type 'never'.
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:36: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<RC1 | RC2> & { x: number; } & { children?: ReactNode; } & { x: string; } & { children?: ReactNode; }'
let a1 = <EmptyRCComp />;
let a2 = <EmptyRCComp data-prop="hello" />;
let b = <PartRCComp />
let c = <PartRCComp data-extra="hello" />
|