• Version 2.1.1
  • Published
  • 226 kB
  • No dependencies
  • MIT license


npm i react-docgen-typescript
yarn add react-docgen-typescript
pnpm add react-docgen-typescript


[![Build Status](](



function getDefaultExportForFile

getDefaultExportForFile: (source: any) => string;

    function parse

    parse: (
    filePathOrPaths: string | string[],
    parserOpts?: ParserOptions
    ) => ComponentDoc[];
    • Parses a file with default TS options

      Parameter filePathOrPaths

      component file that should be parsed

      Parameter parserOpts

      options used to parse the files

    function withCompilerOptions

    withCompilerOptions: (
    compilerOptions: any,
    parserOpts?: ParserOptions
    ) => FileParser;
    • Constructs a parser for a specified set of TS compiler options.

    function withCustomConfig

    withCustomConfig: (
    tsconfigPath: string,
    parserOpts: ParserOptions
    ) => FileParser;
    • Constructs a parser for a specified tsconfig file.

    function withDefaultConfig

    withDefaultConfig: (parserOpts?: ParserOptions) => FileParser;
    • Constructs a parser for a default configuration.


    class Parser

    class Parser {}


      constructor(program: any, opts: ParserOptions);

        method extractDefaultPropsFromComponent

        extractDefaultPropsFromComponent: (symbol: any, source: any) => {};

          method extractMembersFromType

          extractMembersFromType: (type: any) => ts.Symbol[];

            method extractPropsFromTypeIfStatefulComponent

            extractPropsFromTypeIfStatefulComponent: (type: any) => ts.Symbol | null;

              method extractPropsFromTypeIfStatelessComponent

              extractPropsFromTypeIfStatelessComponent: (type: any) => ts.Symbol | null;

                method findDocComment

                findDocComment: (symbol: any) => JSDoc;

                  method getCallSignature

                  getCallSignature: (symbol: any) => any;

                    method getComponentInfo

                    getComponentInfo: (
                    exp: any,
                    source: any,
                    componentNameResolver?: ComponentNameResolver,
                    customComponentTypes?: ParserOptions['customComponentTypes']
                    ) => ComponentDoc | null;

                      method getDocgenType

                      getDocgenType: (propType: any, isRequired: boolean) => PropItemType;

                        method getFullJsDocComment

                        getFullJsDocComment: (symbol: any) => JSDoc;
                        • Extracts a full JsDoc comment from a symbol, even though TypeScript has broken down the JsDoc comment into plain text and JsDoc tags.

                        method getFunctionStatement

                        getFunctionStatement: (
                        statement: any
                        ) =>
                        | ts.ArrowFunction
                        | ts.FunctionExpression
                        | ts.FunctionDeclaration
                        | undefined;

                          method getLiteralValueFromImportSpecifier

                          getLiteralValueFromImportSpecifier: (
                          property: any
                          ) => string | boolean | number | null | undefined;

                            method getLiteralValueFromPropertyAssignment

                            getLiteralValueFromPropertyAssignment: (
                            property: ts.PropertyAssignment | ts.BindingElement
                            ) => string | boolean | number | null | undefined;

                              method getMethodsInfo

                              getMethodsInfo: (type: any) => Method[];

                                method getModifiers

                                getModifiers: (member: any) => string[];

                                  method getParameterInfo

                                  getParameterInfo: (callSignature: any) => MethodParameter[];

                                    method getPropMap

                                    getPropMap: (
                                    properties: any
                                    ) => StringIndexedObject<string | boolean | number | null>;

                                      method getPropsInfo

                                      getPropsInfo: (
                                      propsObj: any,
                                      defaultProps?: StringIndexedObject<string>
                                      ) => Props;

                                        method getReturnDescription

                                        getReturnDescription: (symbol: any) => SymbolDisplayPart[] | undefined;

                                          method isTaggedPublic

                                          isTaggedPublic: (symbol: any) => boolean;


                                            interface ComponentDoc

                                            interface ComponentDoc {}

                                              property description

                                              description: string;

                                                property displayName

                                                displayName: string;

                                                  property filePath

                                                  filePath: string;

                                                    property methods

                                                    methods: Method[];

                                                      property props

                                                      props: Props;

                                                        property tags

                                                        tags?: {};

                                                          interface FileParser

                                                          interface FileParser {}

                                                            method parse

                                                            parse: (filePathOrPaths: string | string[]) => ComponentDoc[];

                                                              method parseWithProgramProvider

                                                              parseWithProgramProvider: (
                                                              filePathOrPaths: string | string[],
                                                              programProvider?: () => ts.Program
                                                              ) => ComponentDoc[];

                                                                interface ParserOptions

                                                                interface ParserOptions {}

                                                                  property componentNameResolver

                                                                  componentNameResolver?: ComponentNameResolver;

                                                                    property customComponentTypes

                                                                    customComponentTypes?: string[];

                                                                      property propFilter

                                                                      propFilter?: StaticPropFilter | PropFilter;

                                                                        property savePropValueAsString

                                                                        savePropValueAsString?: boolean;

                                                                          property shouldExtractLiteralValuesFromEnum

                                                                          shouldExtractLiteralValuesFromEnum?: boolean;

                                                                            property shouldExtractValuesFromUnion

                                                                            shouldExtractValuesFromUnion?: boolean;

                                                                              property shouldIncludePropTagMap

                                                                              shouldIncludePropTagMap?: boolean;

                                                                                property shouldRemoveUndefinedFromOptional

                                                                                shouldRemoveUndefinedFromOptional?: boolean;

                                                                                  property skipChildrenPropWithoutDoc

                                                                                  skipChildrenPropWithoutDoc?: boolean;

                                                                                    interface PropItem

                                                                                    interface PropItem {}

                                                                                      property declarations

                                                                                      declarations?: ParentType[];

                                                                                        property defaultValue

                                                                                        defaultValue: any;

                                                                                          property description

                                                                                          description: string;

                                                                                            property name

                                                                                            name: string;

                                                                                              property parent

                                                                                              parent?: ParentType;

                                                                                                property required

                                                                                                required: boolean;

                                                                                                  property tags

                                                                                                  tags?: {};

                                                                                                    property type

                                                                                                    type: PropItemType;

                                                                                                      interface PropItemType

                                                                                                      interface PropItemType {}

                                                                                                        property name

                                                                                                        name: string;

                                                                                                          property raw

                                                                                                          raw?: string;

                                                                                                            property value

                                                                                                            value?: any;

                                                                                                              interface Props

                                                                                                              interface Props extends StringIndexedObject<PropItem> {}

                                                                                                                Package Files (2)

                                                                                                                Dependencies (0)

                                                                                                                No dependencies.

                                                                                                                Dev Dependencies (19)

                                                                                                                Peer Dependencies (1)


                                                                                                                To add a badge like this badgeto your package's README, use the codes available below.

                                                                                                                You may also use to create a custom badge linking to

                                                                                                                • Markdown
                                                                                                                • HTML
                                                                                                                  <a href=""><img src="" alt=""></a>