Skip to content

Domain

Data models shared by the docgen parser, checker, and printer.

17 exports Added in v0.6.0 Source

Errors

DocgenError

Added in v0.6.0 Source

Error reported when documentation generation cannot continue.

Signature

declare class DocgenError extends YieldableError<this> & {
  readonly _tag: "DocgenError";
} & Readonly<{
  readonly message: string;
}> {
  constructor(args: {
    readonly message: string;
  });
}

Models

Class

Added in v0.6.0 Source

Parsed documentation model for a class and its documented members.

Signature

declare class Class extends DocEntry {
  constructor(name: string, doc: Doc, signature: string, position: Position, methods: readonly Array<DocEntry>, staticMethods: readonly Array<DocEntry>, properties: readonly Array<DocEntry>);
  readonly _tag: "Class";
  readonly methods: readonly Array<DocEntry>;
  readonly properties: readonly Array<DocEntry>;
  readonly staticMethods: readonly Array<DocEntry>;
}

Constant

Added in v0.6.0 Source

Parsed documentation model for a constant.

Signature

declare class Constant extends DocEntry {
  constructor(name: string, doc: Doc, signature: string, position: Position);
  readonly _tag: "Constant";
}

Doc

Added in v0.6.0 Source

Parsed JSDoc content attached to a declaration or module.

Signature

declare class Doc {
  constructor(description: string | undefined, since: readonly Array<string>, deprecated: readonly Array<string>, examples: readonly Array<string>, category: readonly Array<string>, throws: readonly Array<string>, sees: readonly Array<string>, tags: Record<string, ReadonlyArray<string> | undefined>);
  readonly category: readonly Array<string>;
  readonly deprecated: readonly Array<string>;
  readonly description: string | undefined;
  readonly examples: readonly Array<string>;
  readonly sees: readonly Array<string>;
  readonly since: readonly Array<string>;
  readonly tags: Record<string, ReadonlyArray<string> | undefined>;
  readonly throws: readonly Array<string>;
  modifyDescription(description: string | undefined): Doc;
}

DocEntry

Added in v0.6.0 Source

Base model for a named, documented declaration.

Signature

declare class DocEntry {
  constructor(name: string, doc: Doc, signature: string, position: Position);
  readonly doc: Doc;
  readonly name: string;
  readonly position: Position;
  readonly signature: string;
}

Export

Added in v0.6.0 Source

Parsed documentation model for an explicit named or namespace export.

Signature

declare class Export extends DocEntry {
  constructor(
    name: string,
    doc: Doc,
    signature: string,
    position: Position,
    isNamespaceExport: boolean,
  );
  readonly _tag: "Export";
  readonly isNamespaceExport: boolean;
}

File

Added in v0.6.0 Source

Represents a file which can be optionally overwriteable.

Signature

declare class File {
  constructor(path: string, content: string, isOverwriteable: boolean);
  readonly content: string;
  readonly isOverwriteable: boolean;
  readonly path: string;
}

Function

Added in v0.6.0 Source

Parsed documentation model for a function.

Signature

declare class Function extends DocEntry {
  constructor(name: string, doc: Doc, signature: string, position: Position);
  readonly _tag: "Function";
}

Interface

Added in v0.6.0 Source

Parsed documentation model for an interface.

Signature

declare class Interface extends DocEntry {
  constructor(name: string, doc: Doc, signature: string, position: Position);
  readonly _tag: "Interface";
}

Module

Added in v0.6.0 Source

Parsed documentation model for one source module.

Signature

declare class Module {
  constructor(source: SourceShape, name: string, doc: Doc, path: readonly [string, string], classes: readonly Array<Class>, interfaces: readonly Array<Interface>, functions: readonly Array<Function>, typeAliases: readonly Array<TypeAlias>, constants: readonly Array<Constant>, exports: readonly Array<Export>, namespaces: readonly Array<Namespace>);
  readonly classes: readonly Array<Class>;
  readonly constants: readonly Array<Constant>;
  readonly doc: Doc;
  readonly exports: readonly Array<Export>;
  readonly functions: readonly Array<Function>;
  readonly interfaces: readonly Array<Interface>;
  readonly name: string;
  readonly namespaces: readonly Array<Namespace>;
  readonly path: readonly [string, string];
  readonly source: SourceShape;
  readonly typeAliases: readonly Array<TypeAlias>;
}

Namespace

Added in v0.6.0 Source

Parsed documentation model for a namespace and its nested declarations.

Signature

declare class Namespace {
  constructor(name: string, doc: Doc, position: Position, interfaces: readonly Array<Interface>, typeAliases: readonly Array<TypeAlias>, namespaces: readonly Array<Namespace>);
  readonly _tag: "Namespace";
  readonly doc: Doc;
  readonly interfaces: readonly Array<Interface>;
  readonly name: string;
  readonly namespaces: readonly Array<Namespace>;
  readonly position: Position;
  readonly typeAliases: readonly Array<TypeAlias>;
}

Position interface

Added in v0.6.0 Source

One-based source position used in diagnostics.

Signature

interface Position {
  readonly column: number;
  readonly line: number;
}

TypeAlias

Added in v0.6.0 Source

Parsed documentation model for a type alias.

Signature

declare class TypeAlias extends DocEntry {
  constructor(name: string, doc: Doc, signature: string, position: Position);
  readonly _tag: "TypeAlias";
}

Services

Process

Added in v0.6.0 Source

Represents a handle to the currently executing process.

Signature

declare class Process extends Shape<
  "@effect/docgen/Process",
  {
    readonly argv: Effect<Array<string>>;
    readonly cwd: Effect<string>;
    readonly env: Effect<Record<string, string>>;
    readonly platform: Effect<Platform>;
  },
  this
> {
  constructor(_: never);
  static readonly layer: Layer<Process, never, never>;
}

Sorting

ByPath

Added in v0.6.0 Source

A comparator function for sorting Module objects by their file path, represented as a string. The file path is converted to lowercase before comparison.

Signature

declare const ByPath: Order.Order<Module>;

Symbols

Type ID for DocgenError.

Signature

declare const DocgenErrorTypeId: typeof DocgenErrorTypeId;

DocgenErrorTypeId type

Added in v0.6.0 Source

Type-level representation of DocgenErrorTypeId.

Signature

type DocgenErrorTypeId = typeof DocgenErrorTypeId;