Skip to content

Inline function types incorrectly formatted when inside an array or union type alias #2892

New issue

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

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

Already on GitHub? # to your account

Closed
Blackbaud-SteveBrush opened this issue Mar 11, 2025 · 2 comments
Milestone

Comments

@Blackbaud-SteveBrush
Copy link

Blackbaud-SteveBrush commented Mar 11, 2025

Search terms

type alias, function, closure, union, array, formatting

Expected Behavior

Given the following type aliases...

export type FunUnion = (() => boolean) | string;

export type FunArray = (() => boolean)[];

I would expect the types' output to match (() => boolean)[] and (() => boolean) | string.

Actual Behavior

TypeDoc outputs the types as () => boolean[] and () => boolean | string (removes the parenthesis, which results in invalid types).

Steps to reproduce the bug

Clone the following (minimal) repo: https://github.com/Blackbaud-SteveBrush/typedoc-playground

Run npm install && node ./run-typedoc.mjs and observe the output.

TypeDoc: 0.28.0-beta.2
TypeScript: 5.7.3
OS: Mac, Sequoia

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 15, 2025

Bah, I thought I'd gotten all of these edge cases 9 months ago when fixing some other similar issues... easy fix at least!

@Gerrit0 Gerrit0 added this to the v0.28.0 milestone Mar 15, 2025
@Blackbaud-SteveBrush
Copy link
Author

Thanks @Gerrit0 !

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants