Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Getting error "TypeError: Cannot read property 'items' of undefined" #63

Open
hdi-amiri opened this issue Feb 21, 2021 · 14 comments
Open

Comments

@hdi-amiri
Copy link

I am using this library with TypeDoc 0.20.26, I get the json output by setting "json": "json-doc" inside my tsconfig.json file and output is generated. But when I want to use it by entering following command to get the yaml output, I get the error that follows:

type2docfx json-doc.json yaml-dir

$ type2docfx json-doc.json .                                                                            
Warning: nothing genereatd.
Yaml dump start.
Yaml dump end.
Package index generated.
C:\Users\User1\AppData\Roaming\npm\node_modules\type2docfx\dist\main.js:126
var toc = tocGenerator_1.generateTOC(rootElementsForTOC, flattenElements[0].items[0].package);
                                                                            ^

TypeError: Cannot read property 'items' of undefined
    at Object.<anonymous> (C:\Users\User1\AppData\Roaming\npm\node_modules\type2docfx\dist\main.js:126:77)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

type2docfx version: v0.11.2

@iJungleboy
Copy link

Same issue here.

@iJungleboy
Copy link

Just for better debugging here's a copy of my json which couldn't be parsed (I had to rename to .txt so I could upload on github)

dnn-sxc-angular.json.txt

@lishali-fm
Copy link

I have the same issue.

@hiepsolo
Copy link

Same issue here.

@JordoHeffernan
Copy link

Did anyone figure out a fix for this? I'm running into a similar problem.

@XannMagus
Copy link

I'm still having the same issue as well

@Gankarloo
Copy link

Same issue for me to.

@yunair
Copy link
Collaborator

yunair commented Jul 7, 2021

@hadiamiri could you tell me which version of docfx your use?

@SebHoffmRS
Copy link

same problem here.
the isExported flag is missing from the top-level nodes (just like in @iJungleboy 's case file), and I have no idea how to change this.

This is where everything is ignored: https://github.com/docascode/type2docfx/blob/v0.10.5/src/parser.ts#L60

@yunair I use typedoc 0.21.5, type2docfx 0.11.2, and docfx 2.58.0 (btw: why is the docfx version interesting?)

I also don't understand why type2docfx's latest version is 0.11.2 on npmjs.org and the latest version in this repo seems to be 0.10.5.

@SebHoffmRS
Copy link

possibly related: TypeStrong/typedoc#888

@SebHoffmRS
Copy link

As noted in TypeStrong/typedoc#888 ,

The isExported flag was removed in 0.20. TypeDoc only documents exported members now.

See also the release notes https://github.com/TypeStrong/typedoc/releases/tag/v0.20.0 :

isExported / isConstructorProperty ReflectionFlags remvoed

So ignoring nodes without this flag set to true has become incompatible:
https://github.com/docascode/type2docfx/blob/v0.10.5/src/parser.ts#L60

@yunair
Copy link
Collaborator

yunair commented Aug 6, 2021

same problem here.
the isExported flag is missing from the top-level nodes (just like in @iJungleboy 's case file), and I have no idea how to change this.

This is where everything is ignored: https://github.com/docascode/type2docfx/blob/v0.10.5/src/parser.ts#L60

@yunair I use typedoc 0.21.5, type2docfx 0.11.2, and docfx 2.58.0 (btw: why is the docfx version interesting?)

I also don't understand why type2docfx's latest version is 0.11.2 on npmjs.org and the latest version in this repo seems to be 0.10.5.

Because when you use docfx V2, the corresponding version of type2docfx is 0.10.X.
when you use docfx V3, you need to use a version higher than 0.11.0

@yunair
Copy link
Collaborator

yunair commented Aug 6, 2021

The latest version of typedoc that type2docfx support is 0.15
because new version of typedoc change the rule of uid generator, then we can't simply upgrade typedoc.

so if you use docfx V2, you need to install typedoc@0.15.0 and type2docfx@0.10.5.
if you use docfx V3, you need to install typedoc@0.15.0 and type2docfx

@SebHoffmRS
Copy link

thanks for the information!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants