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

[SDK-4011] Fix broken link text in generated documentation #1601

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

lawrence-forooghian
Copy link
Collaborator

Resolves #1560, in which upgrading TypeDoc caused some link text in the generated HTML documentation to become incorrect. See commit messages for more details.

It doesn’t add any value, is inconsistent (we don’t create any other
types for arrays), and I want to introduce a different type with the
same name.
@github-actions github-actions bot temporarily deployed to staging/pull/1601/features January 29, 2024 10:39 Inactive
@lawrence-forooghian lawrence-forooghian marked this pull request as ready for review January 29, 2024 10:40
@github-actions github-actions bot temporarily deployed to staging/pull/1601/typedoc January 29, 2024 10:40 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1601/bundle-report January 29, 2024 10:40 Inactive
We were using TypeDoc’s declaration reference functionality [1] to
disambiguate these, but this broke when we upgraded TypeDoc in 5f69795 —
it started generating link text of ":type" instead of the name of the
type.

This is because TypeDoc 0.24 added the --useTsLinkResolution option,
which is on by default. This option parses @link tags using the
TypeScript compiler. It does this in order to more closely match the way
in which editors such as VS Code will handle @link tags. However, the
TypeScript compiler’s parsing does not support TypeDoc declaration
syntax (and does not offer its own alternative), only falling back to
TypeDoc @link parsing when TypeScript fails to parse a @link. (See the
TypeDoc issue I raised [2] for further context.)

So, stop using declaration references to disambiguate types.

We still make some use of declaration references in modules.d.ts, to
link to the types in ably.d.ts and to link to a specific overload of a
method. These are still being parsed correctly (because TypeScript is
unable to parse them) and there is no good alternative, so I’ll leave
them as is, accepting that editors won’t handle them well (as was always
the case).

Resolves #1560.

[1] https://typedoc.org/guides/declaration-references/
[2] TypeStrong/typedoc#2485
Copy link
Contributor

@VeskeR VeskeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lawrence-forooghian lawrence-forooghian merged commit 7f4e17c into integration/v2 Feb 15, 2024
12 checks passed
@lawrence-forooghian lawrence-forooghian deleted the 1560-fix-typedoc-links branch February 15, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants