Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
eemeli opened this issue Jan 4, 2021 · 1 comment
Closed

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

eemeli opened this issue Jan 4, 2021 · 1 comment
Labels
bug Functionality does not match expectation

Comments

@eemeli
Copy link

eemeli commented Jan 4, 2021

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
@eemeli eemeli added the bug Functionality does not match expectation label Jan 4, 2021
@Gerrit0 Gerrit0 closed this as completed in 685cd3e Jan 4, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 4, 2021

Oh shoot.. this is another instance of #1408. TS does weird things with generic constraints. Fixed in 0.20.11, thanks for the reproduction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants