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

Not resolving {@link NaN} #4

Closed
toebeann opened this issue Aug 22, 2022 · 4 comments
Closed

Not resolving {@link NaN} #4

toebeann opened this issue Aug 22, 2022 · 4 comments

Comments

@toebeann
Copy link

Environment:
Windows 11
Node.js v16.16.0
typescript v4.7.4
typedoc v0.23.10
typedoc-plugin-mdn-links v2.0.0

Maybe I'm just an idiot, but I can't figure out how to actually use this - I've been manually linking to MDN myself so far whenever appropriate.

I figured it was supposed to just auto-resolve {@link NaN}-style links (as well as linkcode and linkplain variants) that it knows about into MDN links, so I added the following to my docs just to test it out:

/**
 * {@link NaN}
 * A helper class to create an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
 * which will abort when any of the signals passed to its constructor do.
 */
export class AggregateSignal {
// ...

And after running npx typedoc --logLevel Verbose I get this output:

> npx typedoc --logLevel Verbose
Loaded plugin typedoc-plugin-mdn-links
Using TypeScript 4.7.4 from ./node_modules/typescript/lib
Converting with 1 programs 1 entry points
Finished getting entry points in 1059ms
Begin readme.md/package.json search at ./
warning Failed to resolve {@link NaN} in AggregateSignal with declaration references. This link will break in v0.24.
Finished conversion in 185ms
warning Failed to resolve link to "NaN" in comment for AggregateSignal
Validation took 1ms
Renderer: Loading highlighter took 345ms
Documentation generated at ./docs
HTML rendering took 645ms

And sure enough the 'NaN' text in the docs is not transformed into a link to the MDN page for NaN.

To me it seems like the plugin isn't even attempting to resolve this link, or it would have printed the following message to the console (as per your index.ts):
[typedoc-plugin-mdn-links]: Failed to resolve type: NaN

I chose the start with NaN since it is included in your globalObjects.ts, but for the life of me I can't figure out how to get it to work. Help pls? 💜

@Gerrit0
Copy link
Owner

Gerrit0 commented Aug 24, 2022

Resolving within {@link} tags isn't supported yet - dependent on TypeStrong/typedoc#2030.

Currently, resolver links only work for types. If you had type N = typeof NaN, then NaN in the type declaration should be linked to MDN.

@toebeann
Copy link
Author

Ah, I see. Thanks for clearing that up!

@Gerrit0
Copy link
Owner

Gerrit0 commented Sep 18, 2022

Unblocked on TypeDoc's side now, but would require {@link typescript!NaN} with the current implementation. The plugin needs an update to also detect global links, which will probably result in a breaking change here since the API necessary to do so is only available on the latest 2 TypeDoc versions.

@Gerrit0
Copy link
Owner

Gerrit0 commented Mar 10, 2023

With v3.0.1, we now recognize {@link !NaN} (the ! is necessary to indicate you want to link to a global, not something called NaN in your project)

@Gerrit0 Gerrit0 closed this as completed Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants