Skip to content

Typedoc should support complex @default values #2219

@ST-DDT

Description

@ST-DDT

Search terms

@default, complex object, jsdoc tag

Expected Behavior

Typedoc should support complex @default values.

Actual Behavior

./index.ts:12:10 - warning Encountered an unescaped open brace without an inline tag

12       * uuid({ foo: "bar" })

./index.ts:12:23 - warning Unmatched closing brace

12       * uuid({ foo: "bar" })

It doesn't output the warning, when using an @example tag.
IMO @default refers to a value and thus should behave the same as @example.

Steps to reproduce the bug

import type { ProjectReflection, TypeDocOptions } from "typedoc";
import { Application, TSConfigReader } from "typedoc";

/**
 * Foo.
 */
export function foo(options: {
  /**
   * @example uuid({ foo: "bar" })
   */
  bar: string;
}) {
  return options.bar;
}

function loadProject(
  options: Partial<TypeDocOptions> = {
    entryPoints: ["index.ts"],
    pretty: true,
    cleanOutputDir: true,
  }
): [Application, ProjectReflection] {
  const app = new Application();
  app.options.addReader(new TSConfigReader());
  app.bootstrap(options);
  const project = app.convert();
  app.generateJson(project, "output.json");

  return [app, project];
}

loadProject();

Environment

  • Typedoc version: 0.23.28
  • TypeScript version: 5.0.3, 4.9.5 (doesn't really matter)
  • Node.js version: v18.15.0
  • OS: Win10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions