TypeScript/tests/baselines/reference/tsxUnionElementType4.errors.txt
Wesley Wigham 84f5aa540e
Put error spans deep on nested object literals (#25140)
* Add ncie deep elaborations

* Nice stuff

* Modify tuple error to use length error mroe often

* Accept good baselines

* Accept meh baselines

* Fix literal types

* Calculate elaborations like it was the very first time again~

* Use tristate for enum relationship to ensure elaborations are printed at least once

* Update message text, nits

* move some functions back to where they were

* Add test of deep JSX elaboration

* Add elaboration test with parenthesized expressions, comma expressions, and assignments

* Move check to allow elaborations on more anonymous types

* Fix nits

* Add specialized error to elaborations of nonliteral computed named-members

* Update error message
2018-07-03 19:40:58 -07:00

48 lines
2.1 KiB
Plaintext

tests/cases/conformance/jsx/file.tsx(32,17): error TS2322: Type 'true' is not assignable to type 'ReactText'.
tests/cases/conformance/jsx/file.tsx(33,10): error TS2559: Type '{ x: number; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: ReactNode; }'.
tests/cases/conformance/jsx/file.tsx(34,10): error TS2559: Type '{ prop: true; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: ReactNode; }'.
==== tests/cases/conformance/jsx/file.tsx (3 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 RCComp = RC1 || RC2;
var EmptyRCComp = RC3 || RC4;
var PartRCComp = RC1 || RC4;
// Error
let a = <RCComp x />;
~
!!! error TS2322: Type 'true' is not assignable to type 'ReactText'.
!!! 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> & { x: number; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes<RC2> & { x: string; } & { children?: ReactNode; })'
let b = <PartRCComp x={10} />
~~~~~~~~~~
!!! error TS2559: Type '{ x: number; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: ReactNode; }'.
let c = <EmptyRCComp prop />;
~~~~~~~~~~~
!!! error TS2559: Type '{ prop: true; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: ReactNode; }'.