react-docgen-typescript
Advanced tools
Comparing version
@@ -153,4 +153,4 @@ "use strict"; | ||
}); | ||
it('should parse react component with default props', function () { | ||
testUtils_1.check('ComponentWithDefaultProps', { | ||
describe('component with default props', function () { | ||
var expectation = { | ||
ComponentWithDefaultProps: { | ||
@@ -187,3 +187,9 @@ sampleDefaultFromJSDoc: { | ||
} | ||
}; | ||
it('should parse defined props', function () { | ||
testUtils_1.check('ComponentWithDefaultProps', expectation); | ||
}); | ||
it('should parse referenced props', function () { | ||
testUtils_1.check('ComponentWithReferencedDefaultProps', expectation); | ||
}); | ||
}); | ||
@@ -190,0 +196,0 @@ it('should parse react PureComponent', function () { |
@@ -276,2 +276,13 @@ "use strict"; | ||
var properties = initializer.properties; | ||
while (ts.isIdentifier(initializer)) { | ||
var defaultPropsReference = this.checker.getSymbolAtLocation(initializer); | ||
if (defaultPropsReference) { | ||
var declarations = defaultPropsReference.getDeclarations(); | ||
if (declarations) { | ||
initializer = declarations[0] | ||
.initializer; | ||
properties = initializer.properties; | ||
} | ||
} | ||
} | ||
var propMap = getPropMap(properties); | ||
@@ -278,0 +289,0 @@ return propMap; |
{ | ||
"name": "react-docgen-typescript", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -133,2 +133,4 @@ # react-docgen-typescript | ||
**@argshook** *Arijus Šukys* | ||
**@asilgag** *Alberto Silva* | ||
@@ -135,0 +137,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
92069
1.54%1153
1.5%164
1.23%