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

Types across monorepo packages are not linked #47

Open
nazarhussain opened this issue Jun 22, 2022 · 4 comments
Open

Types across monorepo packages are not linked #47

nazarhussain opened this issue Jun 22, 2022 · 4 comments

Comments

@nazarhussain
Copy link

Hi,

I am using this plugin to generate API docs for a mono repo. There is one concern I could not resolve, the types reference across mono-repo packages are not linked.

There is a typeodc plugin for this purpose, which is loaded but not performs what's expected.
https://github.com/luizstacio/typedoc-monorepo-link-types

When we have following snippet.

// packages/package-1/src/index.ts

import {BaseClass} from 'package-2';

class ExtendedClass extends BaseClass { }

The docs for the ExtendedClass under hierarchy section does not link the BaseClass.

If we use the @link for those imported types these works fine.

// packages/package-1/src/index.ts

import {BaseClass} from 'package-2';

/**
* {@link BaseClass}
*/
class ExtendedClass extends BaseClass { }

In above snippet the @link modifier works fine and points to the right package in the API docs. That means the type info is available but not rendered properly. This seems to be a very basic behavior for a mono-repo packages.

Is there some configuration to enable this or is it a bug?

@milesj
Copy link
Owner

milesj commented Jul 10, 2022

I tried the typedoc-monorepo-link-types plugin, but it doesn't seem like the JSON output is altered in anyway, so I still don't have access to the linked data.

@jan-molak
Copy link
Contributor

jan-molak commented Jul 31, 2022

Hey @milesj! It looks to be a limitation of TypeDoc itself - TypeStrong/typedoc#1612

I tried typedoc-monorepo-link-types and it seems like it might be part of the solution.
However, instead of "linking" to types from other packages, it creates an artificial "internal" namespace in each package, where it aggregates any types TypeDoc couldn't resolve within the package itself, copying their documentation.

Screenshot 2022-08-01 at 00 37 25

Here's the "internal" namespace with Interaction (internal class) docs copied over from the core package:

Screenshot 2022-08-01 at 00 43 26

And here's the Interaction documented within the core package:

Screenshot 2022-08-01 at 00 43 54

Apart from duplication of documentation, another problem with typedoc-monorepo-link-types is that links to types in aggregate pages link to incorrect internal packages.


I do wonder if we could take some inspiration from typedoc-monorepo-link-types, but instead of producing aggregate pages link to correct internal packages?

@nazarhussain
Copy link
Author

I do wonder if we could take some inspiration from typedoc-monorepo-link-types, but instead of producing aggregate pages link to correct internal packages?

that will be a nice idea.

@milesj
Copy link
Owner

milesj commented Aug 1, 2022

Yeah, I feel like we might need to build our own plugin, or at least fork typedoc-monorepo-link-types to get it to work the way we want.

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

3 participants