mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
//// [tests/cases/conformance/jsx/tsxSpreadAttributesResolution2.tsx] ////
|
|
|
|
//// [file.tsx]
|
|
/// <reference path="/.lib/react.d.ts" />
|
|
|
|
import React = require('react');
|
|
|
|
interface PoisonedProp {
|
|
x: string;
|
|
y: "2";
|
|
}
|
|
|
|
class Poisoned extends React.Component<PoisonedProp, {}> {
|
|
render() {
|
|
return <div>Hello</div>;
|
|
}
|
|
}
|
|
|
|
const obj = {};
|
|
|
|
// OK
|
|
<Poisoned {...{x: "ok", y: "2"}} />;
|
|
|
|
// Error
|
|
let p = <Poisoned {...obj} />;
|
|
let y = <Poisoned />;
|
|
let z = <Poisoned x y/>;
|
|
let w = <Poisoned {...{x: 5, y: "2"}}/>;
|
|
let w1 = <Poisoned {...{x: 5, y: "2"}} X="hi" />;
|
|
|
|
//// [file.jsx]
|
|
"use strict";
|
|
/// <reference path="/.lib/react.d.ts" />
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const React = require("react");
|
|
class Poisoned extends React.Component {
|
|
render() {
|
|
return <div>Hello</div>;
|
|
}
|
|
}
|
|
const obj = {};
|
|
// OK
|
|
<Poisoned {...{ x: "ok", y: "2" }}/>;
|
|
// Error
|
|
let p = <Poisoned {...obj}/>;
|
|
let y = <Poisoned />;
|
|
let z = <Poisoned x y/>;
|
|
let w = <Poisoned {...{ x: 5, y: "2" }}/>;
|
|
let w1 = <Poisoned {...{ x: 5, y: "2" }} X="hi"/>;
|