swc/tests/tsc-references/jsx/tsxStatelessFunctionComponentOverload2x/input.tsx/es5.1.normal/output.js

70 lines
1.6 KiB
JavaScript

function _extends() {
_extends = Object.assign || function(target) {
for(var i = 1; i < arguments.length; i++){
var source = arguments[i];
for(var key in source){
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
// @filename: file.tsx
// @jsx: preserve
// @module: amd
// @noLib: true
// @skipLibCheck: true
// @libFiles: react.d.ts,lib.d.ts
var React = require('react');
var obj = {
yy: 10,
yy1: "hello"
};
var obj1 = {
yy: true
};
var obj2 = {
yy: 500,
"ignore-prop": "hello"
};
var defaultObj;
// OK
var c1 = /*#__PURE__*/ React.createElement(OneThing, null);
var c2 = /*#__PURE__*/ React.createElement(OneThing, _extends({
}, obj));
var c3 = /*#__PURE__*/ React.createElement(OneThing, _extends({
}, {
}));
var c4 = /*#__PURE__*/ React.createElement(OneThing, _extends({
}, obj1, obj));
var c5 = /*#__PURE__*/ React.createElement(OneThing, _extends({
}, obj1, {
yy: 42
}, {
yy1: "hi"
}));
var c6 = /*#__PURE__*/ React.createElement(OneThing, _extends({
}, obj1, {
yy: 10000,
yy1: "true"
}));
var c7 = /*#__PURE__*/ React.createElement(OneThing, _extends({
}, defaultObj, {
yy: true
}, obj)); // No error. should pick second overload
var c8 = /*#__PURE__*/ React.createElement(OneThing, {
"ignore-prop": 100
});
var c9 = /*#__PURE__*/ React.createElement(OneThing, _extends({
}, {
"ignore-prop": 200
}));
var c10 = /*#__PURE__*/ React.createElement(OneThing, _extends({
}, obj2, {
yy1: "boo"
}));
export { };