Skip to content

Repro case for monorepo with cross references to other package #32

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
# TypeDoc reproductions
# Reproduce

If you find a bug in TypeDoc and file an issue, it's helpful -- even necessary -- to create a minimal reproduction of the bug.
```
$ npm install
$ npm run build -w base
$ npm run build -w sub
$ npx [email protected] --out ./docs
```

This link explains why we ask for a minimal reproduction. Thank you in advance!
https://gist.github.com/Rich-Harris/88c5fc2ac6dc941b22e7996af05d70ff
# Primary erroneous results:
* Docs for class `Sub` must have a link in comment "Class that implements IBase". However, `IBase` is not a link, just text.
* Docs for class `Sub` must have a link in "Implements - IBase". However, `IBase` is not link, just text.
* Docs for class `Sub` must have a link in method baz which returns "IBase". However, `IBase` is not link, just text.
* Docs for class `Sub` must have a link for parameter `foo` of method `another` which is of type "IBase". However, `IBase` is not link, just text.
* Docs for interface `IBase` should have in the comment links to `ISub` and `Sub`.

One way to do that is opening a pull-request on this repository with your reproduction. Github Actions will execute `./run.sh`.
These 4 errors should, IMHO, just work. It is annoying in a monorepo that you cannot link to other packages. There may be other occurrances (like having IBase as part of a method parameter, etc).

You can put anything you want here: add/remove dependencies in `package.json`, change the commands in `run.sh`, change the code in `./src/index.ts`,
or add a hundred more `.ts` files.
# Secondary erroneous result:
These may not be a bug but a related feature request.

Once your pull request is submitted here, link to it in your TypeDoc bug report.
* Docs for `IBase` should mention `Sub` as implementiSng class and `ISub` as derived interface.

Forked from the [ts-node-repros](https://github.com/TypeStrong/ts-node-repros) for TypeDoc.
So, subclasses/interfaces in other packages within the monorepo should be listed for the base class, even if it is in another package.
6 changes: 6 additions & 0 deletions base/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# don't ever lint node_modules
node_modules
# don't lint build output
lib
# don't lint nyc coverage output
coverage
16 changes: 16 additions & 0 deletions base/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"no-constant-condition": ["error", { "checkLoops": false }]
}
};
2 changes: 2 additions & 0 deletions base/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore all differences in line endings
* -crlf
6 changes: 6 additions & 0 deletions base/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
lib
.vscode
**/*.nots
typedoc-out.json
docs
7 changes: 7 additions & 0 deletions base/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "none",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"printWidth": 130
}
6 changes: 6 additions & 0 deletions base/jestconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"preset": "ts-jest",
"bail": 1,
"verbose": false,
"reporters": ["jest-standard-reporter"]
}
14 changes: 14 additions & 0 deletions base/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@mytest/base",
"main": "lib/index.js",
"devDependencies": {
"typescript": "^4.9.4"
},
"scripts": {
"build": "tsc"
},
"files": [
"lib/**/*",
"NOTICE"
]
}
6 changes: 6 additions & 0 deletions base/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* See {@link ISub} and {@link Sub}.
*/
export interface IBase {
foo(): void;
}
17 changes: 17 additions & 0 deletions base/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"declaration": true,
"outDir": "./lib",
"strict": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*"],
"typedocOptions": {
"entryPoints": ["src"]
}
}
43 changes: 43 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "typedoc-repros",
"dependencies": {
"typedoc": "latest",
"typescript": "latest"
}
}
"workspaces": [
"./base",
"./sub"
]
}
23 changes: 0 additions & 23 deletions run.sh

This file was deleted.

4 changes: 0 additions & 4 deletions src/index.ts

This file was deleted.

6 changes: 6 additions & 0 deletions sub/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# don't ever lint node_modules
node_modules
# don't lint build output
lib
# don't lint nyc coverage output
coverage
16 changes: 16 additions & 0 deletions sub/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"no-constant-condition": ["error", { "checkLoops": false }]
}
};
6 changes: 6 additions & 0 deletions sub/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
lib
.vscode
**/*.nots
typedoc-out.json
docs
7 changes: 7 additions & 0 deletions sub/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "none",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"printWidth": 130
}
6 changes: 6 additions & 0 deletions sub/jestconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"preset": "ts-jest",
"bail": 1,
"verbose": false,
"reporters": ["jest-standard-reporter"]
}
11 changes: 11 additions & 0 deletions sub/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@mytest/sub",
"main": "lib/index.js",
"scripts": {
"build": "tsc"
},
"files": [
"lib/**/*",
"NOTICE"
]
}
30 changes: 30 additions & 0 deletions sub/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This works:
// import { IBase } from '../../base/src';

// This does not work:
import { IBase } from '@mytest/base';


/**
* Interface that extends {@link IBase}
*/
export interface ISub extends IBase {
bar(): void;
}

/**
* Class that implements {@link IBase}
*/
export class Sub implements IBase {
foo(): void {
//
}

baz(): IBase | undefined {
return undefined;
}

another(foo: IBase): void {
//
}
}
18 changes: 18 additions & 0 deletions sub/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"declaration": true,
"outDir": "./lib",
"strict": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"],
"entryPointStrategy": "resolve",
},
}
6 changes: 0 additions & 6 deletions tsconfig.json

This file was deleted.

10 changes: 3 additions & 7 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["src/index.ts"],

"treatWarningsAsErrors": true,
"out": "docs",
"json": "docs/docs.json"
}
"entryPoints": ["base", "sub"],
"entryPointStrategy": "packages",
}