mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add another test case and change condition for ns merge to require signature or export content
This commit is contained in:
@@ -5778,6 +5778,7 @@ namespace ts {
|
||||
return getObjectFlags(typeToSerialize) & (ObjectFlags.Anonymous | ObjectFlags.Mapped) &&
|
||||
!getIndexInfoOfType(typeToSerialize, IndexKind.String) &&
|
||||
!getIndexInfoOfType(typeToSerialize, IndexKind.Number) &&
|
||||
!!(length(getPropertiesOfType(typeToSerialize)) || length(getSignaturesOfType(typeToSerialize, SignatureKind.Call))) &&
|
||||
!length(getSignaturesOfType(typeToSerialize, SignatureKind.Construct)) && // TODO: could probably serialize as function + ns + class, now that that's OK
|
||||
!getDeclarationWithTypeAnnotation(hostSymbol) &&
|
||||
!(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, d => getSourceFileOfNode(d) !== ctxSrc)) &&
|
||||
|
||||
@@ -75,8 +75,25 @@ TabbedShowLayout.defaultProps = {
|
||||
tabs: "default value"
|
||||
};
|
||||
|
||||
export default TabbedShowLayout;
|
||||
|
||||
export default TabbedShowLayout;
|
||||
//// [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;
|
||||
|
||||
//// [jsDeclarationsReactComponents1.js]
|
||||
"use strict";
|
||||
@@ -145,6 +162,26 @@ TabbedShowLayout.defaultProps = {
|
||||
tabs: "default value"
|
||||
};
|
||||
exports.default = TabbedShowLayout;
|
||||
//// [jsDeclarationsReactComponents5.js]
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var react_1 = __importDefault(require("react"));
|
||||
var prop_types_1 = __importDefault(require("prop-types"));
|
||||
function Tree(_a) {
|
||||
var allowDropOnRoot = _a.allowDropOnRoot;
|
||||
return react_1.default.createElement("div", null);
|
||||
}
|
||||
Tree.propTypes = {
|
||||
classes: prop_types_1.default.object,
|
||||
};
|
||||
Tree.defaultProps = {
|
||||
classes: {},
|
||||
parentSource: 'parent_id',
|
||||
};
|
||||
exports.default = Tree;
|
||||
|
||||
|
||||
//// [jsDeclarationsReactComponents1.d.ts]
|
||||
@@ -190,3 +227,20 @@ declare namespace TabbedShowLayout {
|
||||
export const tabs: string;
|
||||
}
|
||||
}
|
||||
//// [jsDeclarationsReactComponents5.d.ts]
|
||||
/// <reference path="../..react16.d.ts" />
|
||||
export default Tree;
|
||||
declare function Tree({ allowDropOnRoot }: {
|
||||
allowDropOnRoot: any;
|
||||
}): JSX.Element;
|
||||
declare namespace Tree {
|
||||
export namespace propTypes {
|
||||
export const classes: PropTypes.Requireable<object>;
|
||||
}
|
||||
export namespace defaultProps {
|
||||
const classes_1: {};
|
||||
export { classes_1 as classes };
|
||||
export const parentSource: string;
|
||||
}
|
||||
}
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
@@ -153,3 +153,47 @@ TabbedShowLayout.defaultProps = {
|
||||
export default TabbedShowLayout;
|
||||
>TabbedShowLayout : Symbol(TabbedShowLayout, Decl(jsDeclarationsReactComponents4.jsx, 1, 5), Decl(jsDeclarationsReactComponents4.jsx, 7, 2))
|
||||
|
||||
=== tests/cases/conformance/jsdoc/declarations/jsDeclarationsReactComponents5.jsx ===
|
||||
import React from 'react';
|
||||
>React : Symbol(React, Decl(jsDeclarationsReactComponents5.jsx, 0, 6))
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
>PropTypes : Symbol(PropTypes, Decl(jsDeclarationsReactComponents5.jsx, 1, 6))
|
||||
|
||||
function Tree({ allowDropOnRoot }) {
|
||||
>Tree : Symbol(Tree, Decl(jsDeclarationsReactComponents5.jsx, 1, 35), Decl(jsDeclarationsReactComponents5.jsx, 5, 1), Decl(jsDeclarationsReactComponents5.jsx, 9, 2))
|
||||
>allowDropOnRoot : Symbol(allowDropOnRoot, Decl(jsDeclarationsReactComponents5.jsx, 3, 15))
|
||||
|
||||
return <div />
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114))
|
||||
}
|
||||
|
||||
Tree.propTypes = {
|
||||
>Tree.propTypes : Symbol(Tree.propTypes, Decl(jsDeclarationsReactComponents5.jsx, 5, 1))
|
||||
>Tree : Symbol(Tree, Decl(jsDeclarationsReactComponents5.jsx, 1, 35), Decl(jsDeclarationsReactComponents5.jsx, 5, 1), Decl(jsDeclarationsReactComponents5.jsx, 9, 2))
|
||||
>propTypes : Symbol(Tree.propTypes, Decl(jsDeclarationsReactComponents5.jsx, 5, 1))
|
||||
|
||||
classes: PropTypes.object,
|
||||
>classes : Symbol(classes, Decl(jsDeclarationsReactComponents5.jsx, 7, 18))
|
||||
>PropTypes.object : Symbol(PropTypes.object, Decl(react16.d.ts, 65, 16))
|
||||
>PropTypes : Symbol(PropTypes, Decl(jsDeclarationsReactComponents5.jsx, 1, 6))
|
||||
>object : Symbol(PropTypes.object, Decl(react16.d.ts, 65, 16))
|
||||
|
||||
};
|
||||
|
||||
Tree.defaultProps = {
|
||||
>Tree.defaultProps : Symbol(Tree.defaultProps, Decl(jsDeclarationsReactComponents5.jsx, 9, 2))
|
||||
>Tree : Symbol(Tree, Decl(jsDeclarationsReactComponents5.jsx, 1, 35), Decl(jsDeclarationsReactComponents5.jsx, 5, 1), Decl(jsDeclarationsReactComponents5.jsx, 9, 2))
|
||||
>defaultProps : Symbol(Tree.defaultProps, Decl(jsDeclarationsReactComponents5.jsx, 9, 2))
|
||||
|
||||
classes: {},
|
||||
>classes : Symbol(classes, Decl(jsDeclarationsReactComponents5.jsx, 11, 21))
|
||||
|
||||
parentSource: 'parent_id',
|
||||
>parentSource : Symbol(parentSource, Decl(jsDeclarationsReactComponents5.jsx, 12, 16))
|
||||
|
||||
};
|
||||
|
||||
export default Tree;
|
||||
>Tree : Symbol(Tree, Decl(jsDeclarationsReactComponents5.jsx, 1, 35), Decl(jsDeclarationsReactComponents5.jsx, 5, 1), Decl(jsDeclarationsReactComponents5.jsx, 9, 2))
|
||||
|
||||
|
||||
@@ -182,3 +182,54 @@ TabbedShowLayout.defaultProps = {
|
||||
export default TabbedShowLayout;
|
||||
>TabbedShowLayout : { (prop: { className: string; }): JSX.Element; defaultProps: { tabs: string; }; }
|
||||
|
||||
=== tests/cases/conformance/jsdoc/declarations/jsDeclarationsReactComponents5.jsx ===
|
||||
import React from 'react';
|
||||
>React : typeof React
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
>PropTypes : typeof PropTypes
|
||||
|
||||
function Tree({ allowDropOnRoot }) {
|
||||
>Tree : typeof Tree
|
||||
>allowDropOnRoot : any
|
||||
|
||||
return <div />
|
||||
><div /> : JSX.Element
|
||||
>div : any
|
||||
}
|
||||
|
||||
Tree.propTypes = {
|
||||
>Tree.propTypes = { classes: PropTypes.object,} : { classes: PropTypes.Requireable<object>; }
|
||||
>Tree.propTypes : { classes: PropTypes.Requireable<object>; }
|
||||
>Tree : typeof Tree
|
||||
>propTypes : { classes: PropTypes.Requireable<object>; }
|
||||
>{ classes: PropTypes.object,} : { classes: PropTypes.Requireable<object>; }
|
||||
|
||||
classes: PropTypes.object,
|
||||
>classes : PropTypes.Requireable<object>
|
||||
>PropTypes.object : PropTypes.Requireable<object>
|
||||
>PropTypes : typeof PropTypes
|
||||
>object : PropTypes.Requireable<object>
|
||||
|
||||
};
|
||||
|
||||
Tree.defaultProps = {
|
||||
>Tree.defaultProps = { classes: {}, parentSource: 'parent_id',} : { classes: {}; parentSource: string; }
|
||||
>Tree.defaultProps : { classes: {}; parentSource: string; }
|
||||
>Tree : typeof Tree
|
||||
>defaultProps : { classes: {}; parentSource: string; }
|
||||
>{ classes: {}, parentSource: 'parent_id',} : { classes: {}; parentSource: string; }
|
||||
|
||||
classes: {},
|
||||
>classes : {}
|
||||
>{} : {}
|
||||
|
||||
parentSource: 'parent_id',
|
||||
>parentSource : string
|
||||
>'parent_id' : "parent_id"
|
||||
|
||||
};
|
||||
|
||||
export default Tree;
|
||||
>Tree : typeof Tree
|
||||
|
||||
|
||||
@@ -83,3 +83,21 @@ TabbedShowLayout.defaultProps = {
|
||||
};
|
||||
|
||||
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;
|
||||
Reference in New Issue
Block a user