Update tests anad baselines

This commit is contained in:
Kanchalai Tanglertsampan 2017-05-04 17:12:52 -07:00
parent f619d5add4
commit d103504ba6
21 changed files with 120 additions and 86 deletions

View file

@ -2,7 +2,6 @@ tests/cases/conformance/jsx/file.tsx(14,15): error TS2322: Type '{ a: 10; b: "hi
Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'. Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'.
Property 'children' is missing in type '{ a: 10; b: "hi"; }'. Property 'children' is missing in type '{ a: 10; b: "hi"; }'.
tests/cases/conformance/jsx/file.tsx(17,11): error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten. tests/cases/conformance/jsx/file.tsx(17,11): error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten.
tests/cases/conformance/jsx/file.tsx(25,11): error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten.
tests/cases/conformance/jsx/file.tsx(31,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'IntrinsicAttributes & Prop'. tests/cases/conformance/jsx/file.tsx(31,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'Prop'. Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'Prop'.
Types of property 'children' are incompatible. Types of property 'children' are incompatible.
@ -29,7 +28,7 @@ tests/cases/conformance/jsx/file.tsx(49,11): error TS2322: Type '{ a: 10; b: "hi
Property 'type' is missing in type 'Element[]'. Property 'type' is missing in type 'Element[]'.
==== tests/cases/conformance/jsx/file.tsx (7 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (6 errors) ====
import React = require('react'); import React = require('react');
interface Prop { interface Prop {
@ -61,8 +60,6 @@ tests/cases/conformance/jsx/file.tsx(49,11): error TS2322: Type '{ a: 10; b: "hi
} }
let k1 = let k1 =
<Comp a={10} b="hi" {...o} > <Comp a={10} b="hi" {...o} >
~~~~~~~~~~~~~~~~~~~~
!!! error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten.
hi hi hi! hi hi hi!
</Comp>; </Comp>;

View file

@ -1,18 +1,17 @@
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(27,24): error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(27,24): error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'LinkProps'.
Property 'goTo' is missing in type '{ extra: true; onClick: (k: "left" | "right") => void; }'.
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(27,64): error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(28,24): error TS2322: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(28,24): error TS2322: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'.
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(29,24): error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(29,43): error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(30,24): error TS2322: Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(30,24): error TS2322: Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(33,25): error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(33,65): error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'.
Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,44): error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,25): error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
==== tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx (6 errors) ==== ==== tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx (7 errors) ====
import React = require('react') import React = require('react')
export interface ClickableProps { export interface ClickableProps {
@ -42,15 +41,17 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,25): err
const b0 = <MainButton {...{onClick: (k) => {console.log(k)}}} extra />; // k has type "left" | "right" const b0 = <MainButton {...{onClick: (k) => {console.log(k)}}} extra />; // k has type "left" | "right"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. !!! error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. !!! error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'LinkProps'.
!!! error TS2322: Property 'goTo' is missing in type '{ extra: true; onClick: (k: "left" | "right") => void; }'.
~~~~~
!!! error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
const b2 = <MainButton onClick={(k)=>{console.log(k)}} extra />; // k has type "left" | "right" const b2 = <MainButton onClick={(k)=>{console.log(k)}} extra />; // k has type "left" | "right"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. !!! error TS2322: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
!!! error TS2322: Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. !!! error TS2322: Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'.
const b3 = <MainButton {...{goTo:"home"}} extra />; // goTo has type"home" | "contact" const b3 = <MainButton {...{goTo:"home"}} extra />; // goTo has type"home" | "contact"
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~
!!! error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. !!! error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
const b4 = <MainButton goTo="home" extra />; // goTo has type "home" | "contact" const b4 = <MainButton goTo="home" extra />; // goTo has type "home" | "contact"
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. !!! error TS2322: Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
@ -58,13 +59,11 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,25): err
export function NoOverload(buttonProps: ButtonProps): JSX.Element { return undefined } export function NoOverload(buttonProps: ButtonProps): JSX.Element { return undefined }
const c1 = <NoOverload {...{onClick: (k) => {console.log(k)}}} extra />; // k has type any const c1 = <NoOverload {...{onClick: (k) => {console.log(k)}}} extra />; // k has type any
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~
!!! error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. !!! error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'.
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'.
export function NoOverload1(linkProps: LinkProps): JSX.Element { return undefined } export function NoOverload1(linkProps: LinkProps): JSX.Element { return undefined }
const d1 = <NoOverload1 {...{goTo:"home"}} extra />; // goTo has type "home" | "contact" const d1 = <NoOverload1 {...{goTo:"home"}} extra />; // goTo has type "home" | "contact"
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~
!!! error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. !!! error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.

View file

@ -6,11 +6,9 @@ tests/cases/conformance/jsx/file.tsx(23,8): error TS2322: Type '{ y: number; }'
tests/cases/conformance/jsx/file.tsx(31,8): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Attribs1'. tests/cases/conformance/jsx/file.tsx(31,8): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Attribs1'.
Types of property 'x' are incompatible. Types of property 'x' are incompatible.
Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(35,8): error TS2322: Type '{ x: string; y: number; extra: number; }' is not assignable to type 'Attribs1'.
Property 'extra' does not exist on type 'Attribs1'.
==== tests/cases/conformance/jsx/file.tsx (4 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
declare module JSX { declare module JSX {
interface Element { } interface Element { }
interface IntrinsicElements { interface IntrinsicElements {
@ -54,12 +52,9 @@ tests/cases/conformance/jsx/file.tsx(35,8): error TS2322: Type '{ x: string; y:
!!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Types of property 'x' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'.
// Error // Ok
var obj6 = { x: 'ok', y: 32, extra: 100 }; var obj6 = { x: 'ok', y: 32, extra: 100 };
<test1 {...obj6} /> <test1 {...obj6} />
~~~~~~~~~
!!! error TS2322: Type '{ x: string; y: number; extra: number; }' is not assignable to type 'Attribs1'.
!!! error TS2322: Property 'extra' does not exist on type 'Attribs1'.
// OK (spread override) // OK (spread override)
var obj7 = { x: 'foo' }; var obj7 = { x: 'foo' };

View file

@ -31,7 +31,7 @@ var obj4 = { x: 32, y: 32 };
var obj5 = { x: 32, y: 32 }; var obj5 = { x: 32, y: 32 };
<test1 x="ok" {...obj5} /> <test1 x="ok" {...obj5} />
// Error // Ok
var obj6 = { x: 'ok', y: 32, extra: 100 }; var obj6 = { x: 'ok', y: 32, extra: 100 };
<test1 {...obj6} /> <test1 {...obj6} />
@ -56,7 +56,7 @@ var obj4 = { x: 32, y: 32 };
// Error // Error
var obj5 = { x: 32, y: 32 }; var obj5 = { x: 32, y: 32 };
<test1 x="ok" {...obj5}/>; <test1 x="ok" {...obj5}/>;
// Error // Ok
var obj6 = { x: 'ok', y: 32, extra: 100 }; var obj6 = { x: 'ok', y: 32, extra: 100 };
<test1 {...obj6}/>; <test1 {...obj6}/>;
// OK (spread override) // OK (spread override)

View file

@ -6,9 +6,13 @@ tests/cases/conformance/jsx/file.tsx(28,25): error TS2322: Type '{ y: true; x: 3
Type '{ y: true; x: 3; overwrite: "hi"; }' is not assignable to type 'Prop'. Type '{ y: true; x: 3; overwrite: "hi"; }' is not assignable to type 'Prop'.
Types of property 'x' are incompatible. Types of property 'x' are incompatible.
Type '3' is not assignable to type '2'. Type '3' is not assignable to type '2'.
tests/cases/conformance/jsx/file.tsx(30,25): error TS2322: Type '{ y: true; x: 2; overwrite: "hi"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<OverWriteAttr> & Prop & { children?: ReactNode; }'.
Type '{ y: true; x: 2; overwrite: "hi"; }' is not assignable to type 'Prop'.
Types of property 'y' are incompatible.
Type 'true' is not assignable to type 'false'.
==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
import React = require('react'); import React = require('react');
const obj = {}; const obj = {};
@ -48,4 +52,11 @@ tests/cases/conformance/jsx/file.tsx(28,25): error TS2322: Type '{ y: true; x: 3
!!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Types of property 'x' are incompatible.
!!! error TS2322: Type '3' is not assignable to type '2'. !!! error TS2322: Type '3' is not assignable to type '2'.
let x2 = <OverWriteAttr {...anyobj} x={3} /> let x2 = <OverWriteAttr {...anyobj} x={3} />
let x3 = <OverWriteAttr overwrite="hi" {...obj1} {...{y: true}} />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ y: true; x: 2; overwrite: "hi"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<OverWriteAttr> & Prop & { children?: ReactNode; }'.
!!! error TS2322: Type '{ y: true; x: 2; overwrite: "hi"; }' is not assignable to type 'Prop'.
!!! error TS2322: Types of property 'y' are incompatible.
!!! error TS2322: Type 'true' is not assignable to type 'false'.

View file

@ -28,6 +28,8 @@ let anyobj: any;
let x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1} /> let x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1} />
let x1 = <OverWriteAttr overwrite="hi" {...obj1} x={3} {...{y: true}} /> let x1 = <OverWriteAttr overwrite="hi" {...obj1} x={3} {...{y: true}} />
let x2 = <OverWriteAttr {...anyobj} x={3} /> let x2 = <OverWriteAttr {...anyobj} x={3} />
let x3 = <OverWriteAttr overwrite="hi" {...obj1} {...{y: true}} />
//// [file.jsx] //// [file.jsx]
@ -67,3 +69,4 @@ var anyobj;
var x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1}/>; var x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1}/>;
var x1 = <OverWriteAttr overwrite="hi" {...obj1} x={3} {...{ y: true }}/>; var x1 = <OverWriteAttr overwrite="hi" {...obj1} x={3} {...{ y: true }}/>;
var x2 = <OverWriteAttr {...anyobj} x={3}/>; var x2 = <OverWriteAttr {...anyobj} x={3}/>;
var x3 = <OverWriteAttr overwrite="hi" {...obj1} {...{ y: true }}/>;

View file

@ -8,9 +8,18 @@ tests/cases/conformance/jsx/file.tsx(19,19): error TS2322: Type '{ x: true; y: t
Type '{ x: true; y: true; }' is not assignable to type 'PoisonedProp'. Type '{ x: true; y: true; }' is not assignable to type 'PoisonedProp'.
Types of property 'x' are incompatible. Types of property 'x' are incompatible.
Type 'true' is not assignable to type 'string'. Type 'true' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(20,19): error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'.
Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
Types of property 'x' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(21,20): error TS2322: Type '{ X: "hi"; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'.
Type '{ X: "hi"; x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
Types of property 'x' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(21,40): error TS2339: Property 'X' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'.
==== tests/cases/conformance/jsx/file.tsx (3 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (6 errors) ====
import React = require('react'); import React = require('react');
interface PoisonedProp { interface PoisonedProp {
@ -42,4 +51,18 @@ tests/cases/conformance/jsx/file.tsx(19,19): error TS2322: Type '{ x: true; y: t
!!! error TS2322: Type '{ x: true; y: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. !!! error TS2322: Type '{ x: true; y: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'.
!!! error TS2322: Type '{ x: true; y: true; }' is not assignable to type 'PoisonedProp'. !!! error TS2322: Type '{ x: true; y: true; }' is not assignable to type 'PoisonedProp'.
!!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Types of property 'x' are incompatible.
!!! error TS2322: Type 'true' is not assignable to type 'string'. !!! error TS2322: Type 'true' is not assignable to type 'string'.
let w = <Poisoned {...{x: 5, y: "2"}}/>;
~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'.
!!! error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
!!! error TS2322: Types of property 'x' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
let w1 = <Poisoned {...{x: 5, y: "2"}} X="hi" />;
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ X: "hi"; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'.
!!! error TS2322: Type '{ X: "hi"; x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
!!! error TS2322: Types of property 'x' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
~~~~~~
!!! error TS2339: Property 'X' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'.

View file

@ -17,7 +17,9 @@ const obj = {};
// Error // Error
let p = <Poisoned {...obj} />; let p = <Poisoned {...obj} />;
let y = <Poisoned />; let y = <Poisoned />;
let z = <Poisoned x y/>; let z = <Poisoned x y/>;
let w = <Poisoned {...{x: 5, y: "2"}}/>;
let w1 = <Poisoned {...{x: 5, y: "2"}} X="hi" />;
//// [file.jsx] //// [file.jsx]
"use strict"; "use strict";
@ -48,3 +50,5 @@ var obj = {};
var p = <Poisoned {...obj}/>; var p = <Poisoned {...obj}/>;
var y = <Poisoned />; var y = <Poisoned />;
var z = <Poisoned x y/>; var z = <Poisoned x y/>;
var w = <Poisoned {...{ x: 5, y: "2" }}/>;
var w1 = <Poisoned {...{ x: 5, y: "2" }} X="hi"/>;

View file

@ -2,11 +2,9 @@ tests/cases/conformance/jsx/file.tsx(20,19): error TS2322: Type '{ x: string; y:
Type '{ x: string; y: number; }' is not assignable to type 'PoisonedProp'. Type '{ x: string; y: number; }' is not assignable to type 'PoisonedProp'.
Types of property 'y' are incompatible. Types of property 'y' are incompatible.
Type 'number' is not assignable to type '2'. Type 'number' is not assignable to type '2'.
tests/cases/conformance/jsx/file.tsx(33,20): error TS2322: Type '{ prop1: boolean; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<EmptyProp> & { children?: ReactNode; }'.
Property 'prop1' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<EmptyProp> & { children?: ReactNode; }'.
==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
import React = require('react'); import React = require('react');
interface PoisonedProp { interface PoisonedProp {
@ -43,8 +41,5 @@ tests/cases/conformance/jsx/file.tsx(33,20): error TS2322: Type '{ prop1: boolea
let o = { let o = {
prop1: false prop1: false
} }
// Error // Ok
let e = <EmptyProp {...o} />; let e = <EmptyProp {...o} />;
~~~~~~
!!! error TS2322: Type '{ prop1: boolean; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<EmptyProp> & { children?: ReactNode; }'.
!!! error TS2322: Property 'prop1' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<EmptyProp> & { children?: ReactNode; }'.

View file

@ -30,7 +30,7 @@ class EmptyProp extends React.Component<{}, {}> {
let o = { let o = {
prop1: false prop1: false
} }
// Error // Ok
let e = <EmptyProp {...o} />; let e = <EmptyProp {...o} />;
//// [file.jsx] //// [file.jsx]
@ -76,5 +76,5 @@ var EmptyProp = (function (_super) {
var o = { var o = {
prop1: false prop1: false
}; };
// Error // Ok
var e = <EmptyProp {...o}/>; var e = <EmptyProp {...o}/>;

View file

@ -7,10 +7,7 @@ tests/cases/conformance/jsx/file.tsx(14,22): error TS2322: Type '{ yy1: true; yy
Type '{ yy1: true; yy: number; }' is not assignable to type '{ yy: number; yy1: string; }'. Type '{ yy1: true; yy: number; }' is not assignable to type '{ yy: number; yy1: string; }'.
Types of property 'yy1' are incompatible. Types of property 'yy1' are incompatible.
Type 'true' is not assignable to type 'string'. Type 'true' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(15,22): error TS2322: Type '{ extra: string; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. tests/cases/conformance/jsx/file.tsx(16,31): error TS2339: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
Property 'extra' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
tests/cases/conformance/jsx/file.tsx(16,22): error TS2322: Type '{ y1: 10000; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
tests/cases/conformance/jsx/file.tsx(17,22): error TS2322: Type '{ yy: boolean; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. tests/cases/conformance/jsx/file.tsx(17,22): error TS2322: Type '{ yy: boolean; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'. Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'.
Types of property 'yy' are incompatible. Types of property 'yy' are incompatible.
@ -36,7 +33,7 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type '{ y1: "hello";
Property 'children' does not exist on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'. Property 'children' does not exist on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
==== tests/cases/conformance/jsx/file.tsx (12 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (11 errors) ====
import React = require('react') import React = require('react')
declare function OneThing(): JSX.Element; declare function OneThing(): JSX.Element;
declare function OneThing(l: {yy: number, yy1: string}): JSX.Element; declare function OneThing(l: {yy: number, yy1: string}): JSX.Element;
@ -63,14 +60,10 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type '{ y1: "hello";
!!! error TS2322: Type '{ yy1: true; yy: number; }' is not assignable to type '{ yy: number; yy1: string; }'. !!! error TS2322: Type '{ yy1: true; yy: number; }' is not assignable to type '{ yy: number; yy1: string; }'.
!!! error TS2322: Types of property 'yy1' are incompatible. !!! error TS2322: Types of property 'yy1' are incompatible.
!!! error TS2322: Type 'true' is not assignable to type 'string'. !!! error TS2322: Type 'true' is not assignable to type 'string'.
const c3 = <OneThing {...obj} {...{extra: "extra attr"}} />; // Extra attribute; const c3 = <OneThing {...obj} {...{extra: "extra attr"}} />; // This is OK becuase all attribute are spread
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ extra: string; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
const c4 = <OneThing {...obj} y1={10000} />; // extra property; const c4 = <OneThing {...obj} y1={10000} />; // extra property;
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~
!!! error TS2322: Type '{ y1: 10000; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. !!! error TS2339: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
!!! error TS2322: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
const c5 = <OneThing {...obj} {...{yy: true}} />; // type incompatible; const c5 = <OneThing {...obj} {...{yy: true}} />; // type incompatible;
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ yy: boolean; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. !!! error TS2322: Type '{ yy: boolean; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'.

View file

@ -13,7 +13,7 @@ let obj2: any;
const c0 = <OneThing extraProp />; // extra property; const c0 = <OneThing extraProp />; // extra property;
const c1 = <OneThing yy={10}/>; // missing property; const c1 = <OneThing yy={10}/>; // missing property;
const c2 = <OneThing {...obj} yy1 />; // type incompatible; const c2 = <OneThing {...obj} yy1 />; // type incompatible;
const c3 = <OneThing {...obj} {...{extra: "extra attr"}} />; // Extra attribute; const c3 = <OneThing {...obj} {...{extra: "extra attr"}} />; // This is OK becuase all attribute are spread
const c4 = <OneThing {...obj} y1={10000} />; // extra property; const c4 = <OneThing {...obj} y1={10000} />; // extra property;
const c5 = <OneThing {...obj} {...{yy: true}} />; // type incompatible; const c5 = <OneThing {...obj} {...{yy: true}} />; // type incompatible;
const c6 = <OneThing {...obj2} {...{extra: "extra attr"}} />; // Should error as there is extra attribute that doesn't match any. Current it is not const c6 = <OneThing {...obj2} {...{extra: "extra attr"}} />; // Should error as there is extra attribute that doesn't match any. Current it is not
@ -50,7 +50,7 @@ define(["require", "exports", "react"], function (require, exports, React) {
var c0 = <OneThing extraProp/>; // extra property; var c0 = <OneThing extraProp/>; // extra property;
var c1 = <OneThing yy={10}/>; // missing property; var c1 = <OneThing yy={10}/>; // missing property;
var c2 = <OneThing {...obj} yy1/>; // type incompatible; var c2 = <OneThing {...obj} yy1/>; // type incompatible;
var c3 = <OneThing {...obj} {...{ extra: "extra attr" }}/>; // Extra attribute; var c3 = <OneThing {...obj} {...{ extra: "extra attr" }}/>; // This is OK becuase all attribute are spread
var c4 = <OneThing {...obj} y1={10000}/>; // extra property; var c4 = <OneThing {...obj} y1={10000}/>; // extra property;
var c5 = <OneThing {...obj} {...{ yy: true }}/>; // type incompatible; var c5 = <OneThing {...obj} {...{ yy: true }}/>; // type incompatible;
var c6 = <OneThing {...obj2} {...{ extra: "extra attr" }}/>; // Should error as there is extra attribute that doesn't match any. Current it is not var c6 = <OneThing {...obj2} {...{ extra: "extra attr" }}/>; // Should error as there is extra attribute that doesn't match any. Current it is not

View file

@ -1,24 +1,31 @@
tests/cases/conformance/jsx/file.tsx(48,24): error TS2322: Type '{ to: "/some/path"; onClick: (e: MouseEvent<any>) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. tests/cases/conformance/jsx/file.tsx(48,24): error TS2322: Type '{ to: "/some/path"; onClick: (e: MouseEvent<any>) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'.
tests/cases/conformance/jsx/file.tsx(49,24): error TS2339: Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'.
tests/cases/conformance/jsx/file.tsx(49,24): error TS2322: Type '{ to: string; onClick: (e: any) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. tests/cases/conformance/jsx/file.tsx(49,24): error TS2322: Type '{ to: string; onClick: (e: any) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. Type '{ to: string; onClick: (e: any) => void; children: string; }' is not assignable to type 'HyphenProps'.
Property '"data-format"' is missing in type '{ to: string; onClick: (e: any) => void; children: string; }'.
tests/cases/conformance/jsx/file.tsx(50,24): error TS2322: Type '{ onClick: () => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. tests/cases/conformance/jsx/file.tsx(50,24): error TS2322: Type '{ onClick: () => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'. Type '{ onClick: () => void; to: string; }' is not assignable to type 'HyphenProps'.
Property '"data-format"' is missing in type '{ onClick: () => void; to: string; }'.
tests/cases/conformance/jsx/file.tsx(51,24): error TS2322: Type '{ onClick: (k: MouseEvent<any>) => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. tests/cases/conformance/jsx/file.tsx(51,24): error TS2322: Type '{ onClick: (k: MouseEvent<any>) => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'. Type '{ onClick: (k: MouseEvent<any>) => void; to: string; }' is not assignable to type 'HyphenProps'.
Property '"data-format"' is missing in type '{ onClick: (k: MouseEvent<any>) => void; to: string; }'.
tests/cases/conformance/jsx/file.tsx(53,24): error TS2322: Type '{ to: string; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. tests/cases/conformance/jsx/file.tsx(53,24): error TS2322: Type '{ to: string; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. Type '{ to: string; onClick(e: any): void; }' is not assignable to type 'HyphenProps'.
Property '"data-format"' is missing in type '{ to: string; onClick(e: any): void; }'.
tests/cases/conformance/jsx/file.tsx(54,24): error TS2322: Type '{ children: 10; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. tests/cases/conformance/jsx/file.tsx(54,24): error TS2322: Type '{ children: 10; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'. Type '{ children: 10; onClick(e: any): void; }' is not assignable to type 'HyphenProps'.
Property '"data-format"' is missing in type '{ children: 10; onClick(e: any): void; }'.
tests/cases/conformance/jsx/file.tsx(55,24): error TS2322: Type '{ children: "hello"; className: true; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. tests/cases/conformance/jsx/file.tsx(55,24): error TS2322: Type '{ children: "hello"; className: true; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'. Type '{ children: "hello"; className: true; onClick(e: any): void; }' is not assignable to type 'HyphenProps'.
Property '"data-format"' is missing in type '{ children: "hello"; className: true; onClick(e: any): void; }'.
tests/cases/conformance/jsx/file.tsx(56,24): error TS2322: Type '{ data-format: true; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. tests/cases/conformance/jsx/file.tsx(56,24): error TS2322: Type '{ data-format: true; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
Type '{ data-format: true; }' is not assignable to type 'HyphenProps'. Type '{ data-format: true; }' is not assignable to type 'HyphenProps'.
Types of property '"data-format"' are incompatible. Types of property '"data-format"' are incompatible.
Type 'true' is not assignable to type 'string'. Type 'true' is not assignable to type 'string'.
==== tests/cases/conformance/jsx/file.tsx (8 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (9 errors) ====
import React = require('react') import React = require('react')
export interface ClickableProps { export interface ClickableProps {
@ -71,30 +78,38 @@ tests/cases/conformance/jsx/file.tsx(56,24): error TS2322: Type '{ data-format:
!!! error TS2322: Type '{ to: "/some/path"; onClick: (e: MouseEvent<any>) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ to: "/some/path"; onClick: (e: MouseEvent<any>) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
!!! error TS2322: Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'.
const b1 = <MainButton onClick={(e: any)=> {}} {...obj0}>Hello world</MainButton>; // extra property; const b1 = <MainButton onClick={(e: any)=> {}} {...obj0}>Hello world</MainButton>; // extra property;
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2339: Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ to: string; onClick: (e: any) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ to: string; onClick: (e: any) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
!!! error TS2322: Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ to: string; onClick: (e: any) => void; children: string; }' is not assignable to type 'HyphenProps'.
!!! error TS2322: Property '"data-format"' is missing in type '{ to: string; onClick: (e: any) => void; children: string; }'.
const b2 = <MainButton {...{to: "10000"}} {...obj2} />; // extra property const b2 = <MainButton {...{to: "10000"}} {...obj2} />; // extra property
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ onClick: () => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ onClick: () => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
!!! error TS2322: Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ onClick: () => void; to: string; }' is not assignable to type 'HyphenProps'.
!!! error TS2322: Property '"data-format"' is missing in type '{ onClick: () => void; to: string; }'.
const b3 = <MainButton {...{to: "10000"}} {...{onClick: (k) => {}}} />; // extra property const b3 = <MainButton {...{to: "10000"}} {...{onClick: (k) => {}}} />; // extra property
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ onClick: (k: MouseEvent<any>) => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ onClick: (k: MouseEvent<any>) => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
!!! error TS2322: Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ onClick: (k: MouseEvent<any>) => void; to: string; }' is not assignable to type 'HyphenProps'.
!!! error TS2322: Property '"data-format"' is missing in type '{ onClick: (k: MouseEvent<any>) => void; to: string; }'.
const b4 = <MainButton {...obj3} to />; // Should error because Incorrect type; but attributes are any so everything is allowed const b4 = <MainButton {...obj3} to />; // Should error because Incorrect type; but attributes are any so everything is allowed
const b5 = <MainButton {...{ onClick(e: any) { } }} {...obj0} />; // Spread retain method declaration (see GitHub #13365), so now there is an extra attributes const b5 = <MainButton {...{ onClick(e: any) { } }} {...obj0} />; // Spread retain method declaration (see GitHub #13365), so now there is an extra attributes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ to: string; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ to: string; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
!!! error TS2322: Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ to: string; onClick(e: any): void; }' is not assignable to type 'HyphenProps'.
!!! error TS2322: Property '"data-format"' is missing in type '{ to: string; onClick(e: any): void; }'.
const b6 = <MainButton {...{ onClick(e: any){} }} children={10} />; // incorrect type for optional attribute const b6 = <MainButton {...{ onClick(e: any){} }} children={10} />; // incorrect type for optional attribute
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ children: 10; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ children: 10; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
!!! error TS2322: Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ children: 10; onClick(e: any): void; }' is not assignable to type 'HyphenProps'.
!!! error TS2322: Property '"data-format"' is missing in type '{ children: 10; onClick(e: any): void; }'.
const b7 = <MainButton {...{ onClick(e: any){} }} children="hello" className />; // incorrect type for optional attribute const b7 = <MainButton {...{ onClick(e: any){} }} children="hello" className />; // incorrect type for optional attribute
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ children: "hello"; className: true; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ children: "hello"; className: true; onClick(e: any): void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
!!! error TS2322: Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ children: "hello"; className: true; onClick(e: any): void; }' is not assignable to type 'HyphenProps'.
!!! error TS2322: Property '"data-format"' is missing in type '{ children: "hello"; className: true; onClick(e: any): void; }'.
const b8 = <MainButton data-format />; // incorrect type for specified hyphanated name const b8 = <MainButton data-format />; // incorrect type for specified hyphanated name
~~~~~~~~~~~ ~~~~~~~~~~~
!!! error TS2322: Type '{ data-format: true; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. !!! error TS2322: Type '{ data-format: true; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.

View file

@ -14,11 +14,9 @@ tests/cases/conformance/jsx/file.tsx(37,23): error TS2322: Type '{ prop1: true;
tests/cases/conformance/jsx/file.tsx(38,24): error TS2322: Type '{ ref: (x: any) => any; }' is not assignable to type 'IntrinsicAttributes'. tests/cases/conformance/jsx/file.tsx(38,24): error TS2322: Type '{ ref: (x: any) => any; }' is not assignable to type 'IntrinsicAttributes'.
Property 'ref' does not exist on type 'IntrinsicAttributes'. Property 'ref' does not exist on type 'IntrinsicAttributes'.
tests/cases/conformance/jsx/file.tsx(41,16): error TS1005: ',' expected. tests/cases/conformance/jsx/file.tsx(41,16): error TS1005: ',' expected.
tests/cases/conformance/jsx/file.tsx(45,24): error TS2322: Type '{ prop1: boolean; }' is not assignable to type 'IntrinsicAttributes'.
Property 'prop1' does not exist on type 'IntrinsicAttributes'.
==== tests/cases/conformance/jsx/file.tsx (8 errors) ==== ==== tests/cases/conformance/jsx/file.tsx (7 errors) ====
function EmptyPropSFC() { function EmptyPropSFC() {
return <div> Default Greeting </div>; return <div> Default Greeting </div>;
} }
@ -85,11 +83,8 @@ tests/cases/conformance/jsx/file.tsx(45,24): error TS2322: Type '{ prop1: boolea
!!! error TS1005: ',' expected. !!! error TS1005: ',' expected.
} }
// Error // OK as access properties are allow when spread
let i2 = <EmptyPropSFC {...o} /> let i2 = <EmptyPropSFC {...o} />
~~~~~~
!!! error TS2322: Type '{ prop1: boolean; }' is not assignable to type 'IntrinsicAttributes'.
!!! error TS2322: Property 'prop1' does not exist on type 'IntrinsicAttributes'.
let o1: any; let o1: any;
// OK // OK

View file

@ -42,7 +42,7 @@ let o = {
prop1: true; prop1: true;
} }
// Error // OK as access properties are allow when spread
let i2 = <EmptyPropSFC {...o} /> let i2 = <EmptyPropSFC {...o} />
let o1: any; let o1: any;
@ -93,7 +93,7 @@ var i1 = <EmptyPropSFC ref={function (x) { return x.greeting.substr(10); }}/>;
var o = { var o = {
prop1: true prop1: true
}; };
// Error // OK as access properties are allow when spread
var i2 = <EmptyPropSFC {...o}/>; var i2 = <EmptyPropSFC {...o}/>;
var o1; var o1;
// OK // OK

View file

@ -32,7 +32,7 @@ var obj4 = { x: 32, y: 32 };
var obj5 = { x: 32, y: 32 }; var obj5 = { x: 32, y: 32 };
<test1 x="ok" {...obj5} /> <test1 x="ok" {...obj5} />
// Error // Ok
var obj6 = { x: 'ok', y: 32, extra: 100 }; var obj6 = { x: 'ok', y: 32, extra: 100 };
<test1 {...obj6} /> <test1 {...obj6} />

View file

@ -32,3 +32,5 @@ let anyobj: any;
let x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1} /> let x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1} />
let x1 = <OverWriteAttr overwrite="hi" {...obj1} x={3} {...{y: true}} /> let x1 = <OverWriteAttr overwrite="hi" {...obj1} x={3} {...{y: true}} />
let x2 = <OverWriteAttr {...anyobj} x={3} /> let x2 = <OverWriteAttr {...anyobj} x={3} />
let x3 = <OverWriteAttr overwrite="hi" {...obj1} {...{y: true}} />

View file

@ -21,4 +21,6 @@ const obj = {};
// Error // Error
let p = <Poisoned {...obj} />; let p = <Poisoned {...obj} />;
let y = <Poisoned />; let y = <Poisoned />;
let z = <Poisoned x y/>; let z = <Poisoned x y/>;
let w = <Poisoned {...{x: 5, y: "2"}}/>;
let w1 = <Poisoned {...{x: 5, y: "2"}} X="hi" />;

View file

@ -34,5 +34,5 @@ class EmptyProp extends React.Component<{}, {}> {
let o = { let o = {
prop1: false prop1: false
} }
// Error // Ok
let e = <EmptyProp {...o} />; let e = <EmptyProp {...o} />;

View file

@ -18,7 +18,7 @@ let obj2: any;
const c0 = <OneThing extraProp />; // extra property; const c0 = <OneThing extraProp />; // extra property;
const c1 = <OneThing yy={10}/>; // missing property; const c1 = <OneThing yy={10}/>; // missing property;
const c2 = <OneThing {...obj} yy1 />; // type incompatible; const c2 = <OneThing {...obj} yy1 />; // type incompatible;
const c3 = <OneThing {...obj} {...{extra: "extra attr"}} />; // Extra attribute; const c3 = <OneThing {...obj} {...{extra: "extra attr"}} />; // This is OK becuase all attribute are spread
const c4 = <OneThing {...obj} y1={10000} />; // extra property; const c4 = <OneThing {...obj} y1={10000} />; // extra property;
const c5 = <OneThing {...obj} {...{yy: true}} />; // type incompatible; const c5 = <OneThing {...obj} {...{yy: true}} />; // type incompatible;
const c6 = <OneThing {...obj2} {...{extra: "extra attr"}} />; // Should error as there is extra attribute that doesn't match any. Current it is not const c6 = <OneThing {...obj2} {...{extra: "extra attr"}} />; // Should error as there is extra attribute that doesn't match any. Current it is not

View file

@ -46,7 +46,7 @@ let o = {
prop1: true; prop1: true;
} }
// Error // OK as access properties are allow when spread
let i2 = <EmptyPropSFC {...o} /> let i2 = <EmptyPropSFC {...o} />
let o1: any; let o1: any;