You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-docgen-typescript

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-docgen-typescript - npm Package Compare versions

Comparing version

to
1.12.4

15

lib/__tests__/parser.js

@@ -88,2 +88,11 @@ "use strict";

});
it('should parse component with props with external type', function () {
testUtils_1.check('ColumnWithPropsWithExternalType', {
ColumnWithPropsWithExternalType: {
prop1: { type: 'string', required: false },
prop2: { type: 'number' },
prop3: { type: 'MyExternalType' }
}
});
});
it('should parse HOCs', function () {

@@ -658,7 +667,9 @@ testUtils_1.check('ColumnHigherOrderComponent', {

description: 'Documentation for parameter 1',
name: 'myParam'
name: 'myParam',
type: { name: 'number' },
},
{
description: null,
name: 'mySecondParam'
name: 'mySecondParam?',
type: { name: 'string' },
}

@@ -665,0 +676,0 @@ ]);

18

lib/parser.d.ts

@@ -25,6 +25,3 @@ import * as ts from 'typescript';

modifiers: string[];
params: Array<{
name: string;
description?: string | null;
}>;
params: Array<MethodParameter>;
returns?: {

@@ -36,2 +33,10 @@ description?: string | null;

}
export interface MethodParameter {
name: string;
description?: string | null;
type: MethodParameterType;
}
export interface MethodParameterType {
name: string;
}
export interface Component {

@@ -95,6 +100,3 @@ name: string;

getModifiers(member: ts.Symbol): string[];
getParameterInfo(callSignature: ts.Signature): {
description: string | null;
name: string;
}[];
getParameterInfo(callSignature: ts.Signature): Array<MethodParameter>;
getCallSignature(symbol: ts.Symbol): ts.Signature;

@@ -101,0 +103,0 @@ isTaggedPublic(symbol: ts.Symbol): boolean;

@@ -242,5 +242,9 @@ "use strict";

return callSignature.parameters.map(function (param) {
var paramType = _this.checker.getTypeOfSymbolAtLocation(param, param.valueDeclaration);
var paramDeclaration = _this.checker.symbolToParameterDeclaration(param);
var isOptionalParam = !!(paramDeclaration && paramDeclaration.questionToken);
return {
description: ts.displayPartsToString(param.getDocumentationComment(_this.checker)) || null,
name: param.getName()
name: param.getName() + (isOptionalParam ? '?' : ''),
type: { name: _this.checker.typeToString(paramType) }
};

@@ -255,4 +259,4 @@ });

var jsDocTags = symbol.getJsDocTags();
var isPulbic = Boolean(jsDocTags.find(function (tag) { return tag.name === 'public'; }));
return isPulbic;
var isPublic = Boolean(jsDocTags.find(function (tag) { return tag.name === 'public'; }));
return isPublic;
};

@@ -561,2 +565,3 @@ Parser.prototype.getReturnDescription = function (symbol) {

exportName === 'StyledComponentClass' ||
exportName === 'StyledComponent' ||
exportName === 'FunctionComponent' ||

@@ -563,0 +568,0 @@ exportName === 'StatelessComponent') {

{
"name": "react-docgen-typescript",
"version": "1.12.3",
"version": "1.12.4",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet