@types/doctrine

  • Version 0.0.4
  • Published
  • 8.17 kB
  • No dependencies
  • MIT license

Install

npm i @types/doctrine
yarn add @types/doctrine
pnpm add @types/doctrine

Overview

TypeScript definitions for doctrine the JSDoc parser

Index

Variables

variable parseParamType

const parseParamType: (src: string, options?: { midstream: boolean }) => Type;

    variable parseType

    const parseType: (src: string, options?: { midstream: boolean }) => Type;

      variable Syntax

      const Syntax: {
      NullableLiteral: 'NullableLiteral';
      AllLiteral: 'AllLiteral';
      NullLiteral: 'NullLiteral';
      UndefinedLiteral: 'UndefinedLiteral';
      VoidLiteral: 'VoidLiteral';
      UnionType: 'UnionType';
      ArrayType: 'ArrayType';
      RecordType: 'RecordType';
      FieldType: 'FieldType';
      FunctionType: 'FunctionType';
      ParameterType: 'ParameterType';
      RestType: 'RestType';
      NonNullableType: 'NonNullableType';
      OptionalType: 'OptionalType';
      NullableType: 'NullableType';
      NameExpression: 'NameExpression';
      TypeApplication: 'TypeApplication';
      };

        variable version

        const version: string;

          Functions

          function parse

          parse: (content: string, options?: Options) => Annotation;
          • Parse the given content as a jsdoc comment.

          function unwrapComment

          unwrapComment: (doc: string) => string;
          • Remove /*, *, and * / from jsdoc.

          Interfaces

          interface Annotation

          interface Annotation {}
          • Represents a parsed jsdoc comment.

          property description

          description: string;
          • The overall description of the thing being documented.

          property tags

          tags: Tag[];

            interface Options

            interface Options {}

              property lineNumbers

              lineNumbers?: boolean | undefined;
              • Set to true to add lineNumber to each node, specifying the line on which the node is found in the source. Default: false.

              property preserveWhitespace

              preserveWhitespace?: boolean | undefined;
              • Set to true to preserve leading and trailing whitespace when extracting comment text.

              property recoverable

              recoverable?: boolean | undefined;
              • set to true to keep parsing even when syntax errors occur. Default: false.

              property sloppy

              sloppy?: boolean | undefined;
              • Set to true to allow optional parameters to be specified in brackets (@param {string} [foo]). Default: false.

              property strict

              strict?: boolean | undefined;
              • Set to true to throw an error when syntax errors occur. If false then errors will be added to tag.errors instead.

              property tags

              tags?: string[] | undefined;
              • An array of tags to return. When specified, Doctrine returns only tags in this array. For example, if tags is ["param"], then only @param tags will be returned. Default: null.

              property unwrap

              unwrap?: boolean | undefined;
              • Set to true to delete the leading /**, any * that begins a line, and the trailing * / from the source text. Default: false.

              interface Tag

              interface Tag {}
              • Represents a single jsdoc tag.

                So for example: @ param {{ok:String}} userName (ignore the space after the @)

                Would be represented as:

                {title: 'param', name: 'userName', type: {type: 'RecordType", fields: [ {type: 'FieldType', key: 'ok', value: {type: 'NameExpression', name: 'String'}}]}}

              property description

              description: string | null;
              • The description of the thing this tag is documenting.

              property errors

              errors?: string[] | undefined;
              • Any errors that were encountered in parsing the tag.

              property kind

              kind?: string | undefined;

                property name

                name?: string | undefined;
                • The name of the thing this tag is documenting, if any.

                property title

                title: string;
                • The title of the jsdoc tag. e.g. @foo will have a title of 'foo'.

                property type

                type?: Type | null | undefined;
                • The type of the thing this tag is documenting.

                Type Aliases

                type Type

                type Type =
                | type.AllLiteral
                | type.ArrayType
                | type.FieldType
                | type.FunctionType
                | type.NameExpression
                | type.NonNullableType
                | type.NullableLiteral
                | type.NullableType
                | type.NullLiteral
                | type.OptionalType
                | type.ParameterType
                | type.RecordType
                | type.RestType
                | type.TypeApplication
                | type.UndefinedLiteral
                | type.UnionType
                | type.VoidLiteral;

                  Namespaces

                  namespace type

                  namespace type {}

                    variable Syntax

                    const Syntax: {
                    NullableLiteral: 'NullableLiteral';
                    AllLiteral: 'AllLiteral';
                    NullLiteral: 'NullLiteral';
                    UndefinedLiteral: 'UndefinedLiteral';
                    VoidLiteral: 'VoidLiteral';
                    UnionType: 'UnionType';
                    ArrayType: 'ArrayType';
                    RecordType: 'RecordType';
                    FieldType: 'FieldType';
                    FunctionType: 'FunctionType';
                    ParameterType: 'ParameterType';
                    RestType: 'RestType';
                    NonNullableType: 'NonNullableType';
                    OptionalType: 'OptionalType';
                    NullableType: 'NullableType';
                    NameExpression: 'NameExpression';
                    TypeApplication: 'TypeApplication';
                    };

                      function parseParamType

                      parseParamType: (src: string, options?: { midstream: boolean }) => Type;

                        function parseType

                        parseType: (src: string, options?: { midstream: boolean }) => Type;

                          function stringify

                          stringify: (type: Type) => string;

                            interface AllLiteral

                            interface AllLiteral {}

                              property type

                              type: 'AllLiteral';

                                interface ArrayType

                                interface ArrayType {}

                                  property elements

                                  elements: Type[];

                                    property type

                                    type: 'ArrayType';

                                      interface FieldType

                                      interface FieldType {}

                                        property key

                                        key: string;

                                          property type

                                          type: 'FieldType';

                                            property value

                                            value?: Type | undefined;

                                              interface FunctionType

                                              interface FunctionType {}

                                                property 'new'

                                                new: Type;

                                                  property 'this'

                                                  this: Type;

                                                    property params

                                                    params: Type[];

                                                      property result

                                                      result: Type[];

                                                        property type

                                                        type: 'FunctionType';

                                                          interface NameExpression

                                                          interface NameExpression {}

                                                            property name

                                                            name: string;

                                                              property type

                                                              type: 'NameExpression';

                                                                interface NonNullableType

                                                                interface NonNullableType {}

                                                                  property expression

                                                                  expression: Type;

                                                                    property prefix

                                                                    prefix: boolean;

                                                                      property type

                                                                      type: 'NonNullableType';

                                                                        interface NullableLiteral

                                                                        interface NullableLiteral {}

                                                                          property type

                                                                          type: 'NullableLiteral';

                                                                            interface NullableType

                                                                            interface NullableType {}

                                                                              property expression

                                                                              expression: Type;

                                                                                property prefix

                                                                                prefix: boolean;

                                                                                  property type

                                                                                  type: 'NullableType';

                                                                                    interface NullLiteral

                                                                                    interface NullLiteral {}

                                                                                      property type

                                                                                      type: 'NullLiteral';

                                                                                        interface OptionalType

                                                                                        interface OptionalType {}

                                                                                          property expression

                                                                                          expression: Type;

                                                                                            property type

                                                                                            type: 'OptionalType';

                                                                                              interface ParameterType

                                                                                              interface ParameterType {}

                                                                                                property expression

                                                                                                expression: Type;

                                                                                                  property name

                                                                                                  name: string;

                                                                                                    property type

                                                                                                    type: 'ParameterType';

                                                                                                      interface RecordType

                                                                                                      interface RecordType {}

                                                                                                        property fields

                                                                                                        fields: Type[];

                                                                                                          property type

                                                                                                          type: 'RecordType';

                                                                                                            interface RestType

                                                                                                            interface RestType {}

                                                                                                              property expression

                                                                                                              expression?: Type | undefined;

                                                                                                                property type

                                                                                                                type: 'RestType';

                                                                                                                  interface TypeApplication

                                                                                                                  interface TypeApplication {}

                                                                                                                    property applications

                                                                                                                    applications: Type[];

                                                                                                                      property expression

                                                                                                                      expression: Type;

                                                                                                                        property type

                                                                                                                        type: 'TypeApplication';

                                                                                                                          interface UndefinedLiteral

                                                                                                                          interface UndefinedLiteral {}

                                                                                                                            property type

                                                                                                                            type: 'UndefinedLiteral';

                                                                                                                              interface UnionType

                                                                                                                              interface UnionType {}

                                                                                                                                property elements

                                                                                                                                elements: Type[];

                                                                                                                                  property type

                                                                                                                                  type: 'UnionType';

                                                                                                                                    interface VoidLiteral

                                                                                                                                    interface VoidLiteral {}

                                                                                                                                      property type

                                                                                                                                      type: 'VoidLiteral';

                                                                                                                                        Package Files (1)

                                                                                                                                        Dependencies (0)

                                                                                                                                        No dependencies.

                                                                                                                                        Dev Dependencies (0)

                                                                                                                                        No dev dependencies.

                                                                                                                                        Peer Dependencies (0)

                                                                                                                                        No peer dependencies.

                                                                                                                                        Badge

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

                                                                                                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/doctrine.

                                                                                                                                        • Markdown
                                                                                                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/doctrine)
                                                                                                                                        • HTML
                                                                                                                                          <a href="https://www.jsdocs.io/package/@types/doctrine"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>