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

Infinite loop can occur looking up references when re-exports are used #1186

Closed
1 task done
christopherthielen opened this issue Jan 21, 2020 · 2 comments
Closed
1 task done
Labels
bug Functionality does not match expectation

Comments

@christopherthielen
Copy link
Contributor

christopherthielen commented Jan 21, 2020

Expected Behavior

Typedoc should handle re-exports and circular dependencies

Actual Behavior

Typedoc hangs while trying to resolve a re-exported reference if there is a circular dependency between directories.

Steps to reproduce the bug

Create the test case using bash:

mkdir dir1;
mkdir dir2;
echo "import './dir1/file1'" > index.ts
echo "export * from './file1'" > dir1/index.ts
echo "import { CONSTANT_PKG_2 } from '../dir2'" > dir1/file1.ts
echo "export const CONSTANT_PKG_1 = 1" >> dir1/file1.ts
echo "export * from './file2'" > dir2/index.ts
echo "import { CONSTANT_PKG_1 } from '../dir1'" > dir2/file2.ts
echo "export const CONSTANT_PKG_2  = 2" >> dir2/file2.ts

Run typedoc 0.16

npx typedoc@0.16.7 ./index.ts

npx: installed 40 in 3.603s

Using TypeScript 3.7.5 from /Users/xxxxx/.npm/_npx/76441/lib/node_modules/typedoc/node_modules/typescript/lib
No 'out' or 'json' option has been set
The './docs' directory has be set as the output location by default
Rendering [=================-----------------------] 42%

If you debug this node process, you will find it's hung in an infinite loop in tryGetTargetReflectionDeep:

Screen Shot 2020-01-20 at 8 07 10 PM

Note that this works with typedoc 0.15.x:

npx typedoc@0.15.8 --module commonjs ./index.ts
npx: installed 40 in 3.48s

Using TypeScript 3.7.5 from /Users/xxxxx/.npm/_npx/76767/lib/node_modules/typedoc/node_modules/typescript/lib
No 'out' or 'json' option has been set
The './docs' directory has be set as the output location by default
Rendering [========================================] 100%

Documentation generated at /Users/xxxxx/projects/tt/docs

Environment

  • Typedoc version: 0.16.7
  • Node.js version: 10.15.3
  • OS: MacOS
@christopherthielen christopherthielen added the bug Functionality does not match expectation label Jan 21, 2020
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 21, 2020

I could have sworn I saw that and fixed it when first figuring out the themes :/ I'll try to fix this tomorrow.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 21, 2020

Fixed in 0.16.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants