Skip to content

Extending a tuple with an optional member causes an error #1449

@eemeli

Description

@eemeli

Search terms

tuple, optional, convertType

Expected Behavior

Docs should be generated for valid code.

Actual Behavior

Extending a tuple type that includes an optional member causes TypeDoc to exit with an unexpected error. This might be related to #1439.

Steps to reproduce the bug

Try to generate docs for this:

export function fails<T extends [foo: any, bar?: any]>(a: T): T {
  return a;
}

This causes an error Cannot read property 'name' of undefined to be thrown from here

namedMembers[i].name.text,

due to elements having a length that's one greater than the length of namedMembers.

Minimal reproduction: https://gist.github.com/eemeli/a860c474d8a8a221985aa3fc883baed0

Environment

  • Typedoc version: 0.20.10
  • TypeScript version: 4.1.3
  • Node.js version: 14.9.0
  • OS: macOS Mojave 10.14.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions