TypeScript/tests/cases/conformance/jsdoc/declarations/jsDeclarationsReactComponents.ts
Wesley Wigham d28672d97f
Fix alias naming and structure bugs in js declarations (#34786)
* Fix alias naming and structure bugs in js declarations

* Add another test case and change condition for ns merge to require signature or export content

* Fix typo in comment
2019-10-30 12:40:06 -07:00

103 lines
2 KiB
TypeScript

// @allowJs: true
// @checkJs: true
// @target: es5
// @jsx: react
// @esModuleInterop: true
// @outDir: ./out
// @strict: true
// @noImplicitAny: false
// @declaration: true
// @filename: jsDeclarationsReactComponents1.jsx
/// <reference path="/.lib/react16.d.ts" />
import React from "react";
import PropTypes from "prop-types"
const TabbedShowLayout = ({
}) => {
return (
<div />
);
};
TabbedShowLayout.propTypes = {
version: PropTypes.number,
};
TabbedShowLayout.defaultProps = {
tabs: undefined
};
export default TabbedShowLayout;
// @filename: jsDeclarationsReactComponents2.jsx
import React from "react";
/**
* @type {React.SFC}
*/
const TabbedShowLayout = () => {
return (
<div className="" key="">
ok
</div>
);
};
TabbedShowLayout.defaultProps = {
tabs: "default value"
};
export default TabbedShowLayout;
// @filename: jsDeclarationsReactComponents3.jsx
import React from "react";
/**
* @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)}
*/
const TabbedShowLayout = () => {
return (
<div className="" key="">
ok
</div>
);
};
TabbedShowLayout.defaultProps = {
tabs: "default value"
};
export default TabbedShowLayout;
// @filename: jsDeclarationsReactComponents4.jsx
import React from "react";
const TabbedShowLayout = (/** @type {{className: string}}*/prop) => {
return (
<div className={prop.className} key="">
ok
</div>
);
};
TabbedShowLayout.defaultProps = {
tabs: "default value"
};
export default TabbedShowLayout;
// @filename: jsDeclarationsReactComponents5.jsx
import React from 'react';
import PropTypes from 'prop-types';
function Tree({ allowDropOnRoot }) {
return <div />
}
Tree.propTypes = {
classes: PropTypes.object,
};
Tree.defaultProps = {
classes: {},
parentSource: 'parent_id',
};
export default Tree;