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

Crash bug: Nodes without symbols #1660

Closed
ejuda opened this issue Aug 18, 2021 · 1 comment
Closed

Crash bug: Nodes without symbols #1660

ejuda opened this issue Aug 18, 2021 · 1 comment
Labels
bug Functionality does not match expectation

Comments

@ejuda
Copy link
Contributor

ejuda commented Aug 18, 2021

Search terms

node, symbol, property, any

Expected Behavior

It looks like in the following scenario tsc produces a node without a symbol for Source.SomeClass.someProp ([see AST viewer]):

index.d.ts

declare const m: {
    SomeClass: any,
}

export type SomeType = typeof m.SomeClass.someProp;

Type checker in TypeScript playground ([see here]) can correctly deduce the type of SomeType to be any. I'm open to discussion about what TypeDoc should do in this situation, but I think that it at least should not crash.

Actual Behavior

TypeDoc fails to generate documentation due to the following error:

Error: Expected a symbol for node with kind FirstNode at C:/dev/typedoc-symbol-bug-repro/index.d.ts:5
    at Context.expectSymbolAtLocation (C:\dev\typedoc-symbol-bug-repro\node_modules\typedoc\dist\lib\converter\context.js:102:19)
    at Object.convert (C:\dev\typedoc-symbol-bug-repro\node_modules\typedoc\dist\lib\converter\types.js:374:37)
    at Object.convertType (C:\dev\typedoc-symbol-bug-repro\node_modules\typedoc\dist\lib\converter\types.js:76:30)
    at Converter.convertType (C:\dev\typedoc-symbol-bug-repro\node_modules\typedoc\dist\lib\converter\converter.js:60:24)
    at Object.convertTypeAlias (C:\dev\typedoc-symbol-bug-repro\node_modules\typedoc\dist\lib\converter\symbols.js:131:45)
    at Object.convertSymbol (C:\dev\typedoc-symbol-bug-repro\node_modules\typedoc\dist\lib\converter\symbols.js:80:79)
    at Converter.convertExports (C:\dev\typedoc-symbol-bug-repro\node_modules\typedoc\dist\lib\converter\converter.js:181:23)
    at C:\dev\typedoc-symbol-bug-repro\node_modules\typedoc\dist\lib\converter\converter.js:149:30
    at Array.forEach (<anonymous>)
    at Converter.compile (C:\dev\typedoc-symbol-bug-repro\node_modules\typedoc\dist\lib\converter\converter.js:147:17)

Steps to reproduce the bug

  1. Clone the reproduction repository.
  2. npm ci
  3. npm run docs
  4. The Expected a symbol for node with kind FirstNode error should appear.

Environment

  • Typedoc version: 0.21.5
  • TypeScript version: 4.3.5
  • Node.js version: 14.15.4
  • OS: Windows 10
@ejuda ejuda added the bug Functionality does not match expectation label Aug 18, 2021
@ejuda ejuda changed the title Nodes without symbols are not supported Crash bug: Nodes without symbols Aug 18, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 19, 2021

Thanks for the bug report!

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