Skip to content

Bug: error parsing the result type which is an array of maps #1913

@jackens

Description

@jackens

Search terms

type parsing

Expected Behavior

Result type which is an array of maps is correctly parsed

Actual Behavior

Result type which is an array of maps is incorrectly parsed

Steps to reproduce the bug

typedoc.json:

{
  "cleanOutputDir": true,
  "entryPointStrategy": "expand",
  "entryPoints": [
    "src"
  ],
  "hideLegend": true,
  "out": "_doc",
  "readme": "none"
}

tsconfig.json:

{
  "compilerOptions": {
    "allowJs": true,
    "module": "commonjs",
    "outDir": "tmp",
    "target": "esnext"
  },
  "include": [
    "src/**/*.js"
  ]
}

package.json:

{
  "dependencies": {
    "typedoc": "0.22.14",
    "typescript": "4.6.3"
  }
}

src/file.js

/**
 * @returns {[{ [key1: string]: number }, { [key2: string]: string }]}
 */
const fn = () => [{ a: 42 }, { b: '42' }]

module.exports = { fn }

Executing

npm i
npx typedoc

generates a file _doc/index.html that includes line:

Returns [{}, {}]

and the following bugged line:

, { [key2: string]: string }]}

Environment

  • Typedoc version: conf. package.json
  • TypeScript version: conf. package.json
  • Node.js version: v14.17.4
  • OS: MacOS

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