react-docgen-typescript
Advanced tools
Comparing version
@@ -456,2 +456,28 @@ "use strict"; | ||
}); | ||
it('should parse react stateless component with generic intersection + union + omit overlap props', function () { | ||
testUtils_1.check('ComplexGenericUnionIntersectionWithOmit', { | ||
ComplexGenericUnionIntersectionWithOmit: { | ||
as: { | ||
type: 'E', | ||
required: false, | ||
description: 'Render the component as another component' | ||
}, | ||
align: { | ||
description: 'The flex "align" property', | ||
required: false, | ||
type: '"center" | "flex-start" | "flex-end" | "stretch"' | ||
}, | ||
justify: { | ||
description: "Use flex 'center' | 'flex-start' | 'flex-end' | 'stretch' with\na gap between each child.\nUse flex 'space-between' | 'space-around' | 'space-evenly' and\nflex will space the children.", | ||
required: false, | ||
type: '"center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | "space-evenly"' | ||
}, | ||
gap: { | ||
description: 'The space between children\nYou cannot use gap when using a "space" justify property', | ||
required: false, | ||
type: 'ReactText' | ||
} | ||
} | ||
}); | ||
}); | ||
it('should parse react stateful component with intersection props', function () { | ||
@@ -599,2 +625,9 @@ testUtils_1.check('StatefulIntersectionProps', { | ||
}); | ||
it('should parse JSDoc correctly', function () { | ||
testUtils_1.check('JSDocWithParam', { | ||
JSDocWithParam: { | ||
prop1: { type: 'string', required: true } | ||
} | ||
}, true, 'JSDocWithParamProps description\n\nNOTE: If a parent element of this control is `overflow: hidden` then the\nballoon may not show up.'); | ||
}); | ||
it('should parse functional component component defined as const as default export', function () { | ||
@@ -601,0 +634,0 @@ testUtils_1.check('FunctionalComponentAsConstAsDefaultExport', { |
@@ -151,3 +151,3 @@ "use strict"; | ||
var displayName = resolvedComponentName || computeComponentName(nameSource, source); | ||
var description = this.findDocComment(commentSource).fullComment; | ||
var description = this.findDocComment(commentSource).description; | ||
var methods = this.getMethodsInfo(type); | ||
@@ -358,12 +358,12 @@ if (propsType) { | ||
var propsType = this.checker.getTypeOfSymbolAtLocation(propsObj, propsObj.valueDeclaration); | ||
var baseProps = propsType.getProperties(); | ||
var baseProps = propsType.getApparentProperties(); | ||
var propertiesOfProps = baseProps; | ||
if (propsType.isUnionOrIntersection()) { | ||
// Using internal typescript API to get all properties | ||
propertiesOfProps = this.checker.getAllPossiblePropertiesOfTypes(propsType.types); | ||
propertiesOfProps = (propertiesOfProps = this | ||
.checker.getAllPossiblePropertiesOfTypes(propsType.types)).concat(baseProps); | ||
if (!propertiesOfProps.length) { | ||
propertiesOfProps = this | ||
.checker.getAllPossiblePropertiesOfTypes(propsType.types.reduce( | ||
var subTypes = this.checker.getAllPossiblePropertiesOfTypes(propsType.types.reduce( | ||
// @ts-ignore | ||
function (all, t) { return all.concat((t.types || [])); }, [])); | ||
propertiesOfProps = subTypes.concat(baseProps); | ||
} | ||
@@ -370,0 +370,0 @@ } |
{ | ||
"name": "react-docgen-typescript", | ||
"version": "1.20.1", | ||
"version": "1.20.2", | ||
"description": "", | ||
@@ -47,3 +47,3 @@ "homepage": "https://github.com/styleguidist/react-docgen-typescript/", | ||
"source-map-support": "^0.5.6", | ||
"typescript": "3.1.6" | ||
"typescript": "3.5.2" | ||
}, | ||
@@ -50,0 +50,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
180097
1.38%2364
1.42%