diff --git a/README.md b/README.md index 2a3e09f..d2a9fc2 100644 --- a/README.md +++ b/README.md @@ -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 typedoc@0.25 --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. diff --git a/base/.eslintignore b/base/.eslintignore new file mode 100644 index 0000000..7fd6536 --- /dev/null +++ b/base/.eslintignore @@ -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 \ No newline at end of file diff --git a/base/.eslintrc.js b/base/.eslintrc.js new file mode 100644 index 0000000..19410bc --- /dev/null +++ b/base/.eslintrc.js @@ -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 }] + } + }; \ No newline at end of file diff --git a/base/.gitattributes b/base/.gitattributes new file mode 100644 index 0000000..9103071 --- /dev/null +++ b/base/.gitattributes @@ -0,0 +1,2 @@ +# Ignore all differences in line endings +* -crlf \ No newline at end of file diff --git a/base/.gitignore b/base/.gitignore new file mode 100644 index 0000000..c3d61a7 --- /dev/null +++ b/base/.gitignore @@ -0,0 +1,6 @@ +node_modules +lib +.vscode +**/*.nots +typedoc-out.json +docs \ No newline at end of file diff --git a/base/.prettierrc.json b/base/.prettierrc.json new file mode 100644 index 0000000..022a478 --- /dev/null +++ b/base/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "trailingComma": "none", + "tabWidth": 4, + "semi": true, + "singleQuote": true, + "printWidth": 130 + } \ No newline at end of file diff --git a/base/jestconfig.json b/base/jestconfig.json new file mode 100644 index 0000000..7f0657e --- /dev/null +++ b/base/jestconfig.json @@ -0,0 +1,6 @@ +{ + "preset": "ts-jest", + "bail": 1, + "verbose": false, + "reporters": ["jest-standard-reporter"] + } \ No newline at end of file diff --git a/base/package.json b/base/package.json new file mode 100644 index 0000000..f77a759 --- /dev/null +++ b/base/package.json @@ -0,0 +1,14 @@ +{ + "name": "@mytest/base", + "main": "lib/index.js", + "devDependencies": { + "typescript": "^4.9.4" + }, + "scripts": { + "build": "tsc" + }, + "files": [ + "lib/**/*", + "NOTICE" + ] +} diff --git a/base/src/index.ts b/base/src/index.ts new file mode 100644 index 0000000..e99f9ba --- /dev/null +++ b/base/src/index.ts @@ -0,0 +1,6 @@ +/** + * See {@link ISub} and {@link Sub}. + */ +export interface IBase { + foo(): void; +} \ No newline at end of file diff --git a/base/tsconfig.json b/base/tsconfig.json new file mode 100644 index 0000000..7591351 --- /dev/null +++ b/base/tsconfig.json @@ -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"] + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..507c5f5 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,43 @@ +{ + "name": "typedoc-repros", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "workspaces": [ + "./base", + "./sub" + ] + }, + "base": { + "name": "@mytest/base", + "devDependencies": { + "typescript": "^4.9.4" + } + }, + "node_modules/@mytest/base": { + "resolved": "base", + "link": true + }, + "node_modules/@mytest/sub": { + "resolved": "sub", + "link": true + }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "sub": { + "name": "@mytest/sub" + } + } +} diff --git a/package.json b/package.json index a94cd64..565a861 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { - "name": "typedoc-repros", - "dependencies": { - "typedoc": "latest", - "typescript": "latest" - } -} + "workspaces": [ + "./base", + "./sub" + ] +} \ No newline at end of file diff --git a/run.sh b/run.sh deleted file mode 100644 index c7f88cd..0000000 --- a/run.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -# Automatically exit with an error code if any command fails -set -e - -# Install package.json dependencies -yarn - -# Run TypeDoc -yarn typedoc - -echo -echo ======================================================== -echo - -# Print commands before running them, to make CI output easier to understand -set -v - -# You can add additional commands here to make assertions on the output, -# if TypeDoc's output doesn't match what you expected. Here's one example -# checking that the name from package.json is used in TypeDoc's output. - -test $(jq '.name' docs/docs.json) = '"typedoc-repros"' diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index c0a8215..0000000 --- a/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Some code reproducing a bug. - */ -export const bug = 123; diff --git a/sub/.eslintignore b/sub/.eslintignore new file mode 100644 index 0000000..cfdadd9 --- /dev/null +++ b/sub/.eslintignore @@ -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 \ No newline at end of file diff --git a/sub/.eslintrc.js b/sub/.eslintrc.js new file mode 100644 index 0000000..d188c51 --- /dev/null +++ b/sub/.eslintrc.js @@ -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 }] + } + }; \ No newline at end of file diff --git a/sub/.gitignore b/sub/.gitignore new file mode 100644 index 0000000..5ba3949 --- /dev/null +++ b/sub/.gitignore @@ -0,0 +1,6 @@ +node_modules +lib +.vscode +**/*.nots +typedoc-out.json +docs \ No newline at end of file diff --git a/sub/.prettierrc.json b/sub/.prettierrc.json new file mode 100644 index 0000000..aabd8c8 --- /dev/null +++ b/sub/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "trailingComma": "none", + "tabWidth": 4, + "semi": true, + "singleQuote": true, + "printWidth": 130 + } \ No newline at end of file diff --git a/sub/jestconfig.json b/sub/jestconfig.json new file mode 100644 index 0000000..332e24c --- /dev/null +++ b/sub/jestconfig.json @@ -0,0 +1,6 @@ +{ + "preset": "ts-jest", + "bail": 1, + "verbose": false, + "reporters": ["jest-standard-reporter"] + } \ No newline at end of file diff --git a/sub/package.json b/sub/package.json new file mode 100644 index 0000000..ba1cf86 --- /dev/null +++ b/sub/package.json @@ -0,0 +1,11 @@ +{ + "name": "@mytest/sub", + "main": "lib/index.js", + "scripts": { + "build": "tsc" + }, + "files": [ + "lib/**/*", + "NOTICE" + ] +} diff --git a/sub/src/index.ts b/sub/src/index.ts new file mode 100644 index 0000000..4a32e87 --- /dev/null +++ b/sub/src/index.ts @@ -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 { + // + } +} \ No newline at end of file diff --git a/sub/tsconfig.json b/sub/tsconfig.json new file mode 100644 index 0000000..1174e5a --- /dev/null +++ b/sub/tsconfig.json @@ -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", + }, +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 8b08d45..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "strict": true - }, - "include": ["src"] -} diff --git a/typedoc.json b/typedoc.json index c990e40..637c054 100644 --- a/typedoc.json +++ b/typedoc.json @@ -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", +} \ No newline at end of file