mozilla / sphinx-js

Autodoc-style extraction into Sphinx for your JS project
https://pypi.python.org/pypi/sphinx-js/
MIT License
282 stars 81 forks source link

convert_node throwing TypeError #102

Closed ocket8888 closed 4 years ago

ocket8888 commented 5 years ago

Python 3.6.7 Sphinx 1.8.3 sphinx-js 2.7.1 Typedoc 0.14.2 (using Typescript 3.2.4 from its bundled dependencies)

Giving me the error:

Exception occurred:
  File "/usr/local/lib/python3.6/dist-packages/sphinx_js/typedoc.py", line 291, in convert_node
    type = self.make_type(node['getSignature']['type'])
TypeError: list indices must be integers or slices, not str

Sphinx traceback log:

# Sphinx version: 1.8.3
# Python version: 3.6.7 (CPython)
# Docutils version: 0.14 
# Jinja2 version: 2.10
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/sphinx/cmd/build.py", line 303, in build_main
    args.tags, args.verbosity, args.jobs, args.keep_going)
  File "/usr/local/lib/python3.6/dist-packages/sphinx/application.py", line 263, in __init__
    self._init_builder()
  File "/usr/local/lib/python3.6/dist-packages/sphinx/application.py", line 325, in _init_builder
    self.emit('builder-inited')
  File "/usr/local/lib/python3.6/dist-packages/sphinx/application.py", line 510, in emit
    return self.events.emit(event, self, *args)
  File "/usr/local/lib/python3.6/dist-packages/sphinx/events.py", line 80, in emit
    results.append(callback(*args))
  File "/usr/local/lib/python3.6/dist-packages/sphinx_js/doclets.py", line 29, in gather_doclets
    doclets = analyze(abs_source_paths, app)
  File "/usr/local/lib/python3.6/dist-packages/sphinx_js/doclets.py", line 127, in analyze_typescript
    return parse_typedoc(temp)
  File "/usr/local/lib/python3.6/dist-packages/sphinx_js/typedoc.py", line 344, in parse_typedoc
    typedoc = TypeDoc(json.load(inputfile))
  File "/usr/local/lib/python3.6/dist-packages/sphinx_js/typedoc.py", line 55, in __init__
    self.convert_node(root)
  File "/usr/local/lib/python3.6/dist-packages/sphinx_js/typedoc.py", line 324, in convert_node
    self.convert_node(child)
  File "/usr/local/lib/python3.6/dist-packages/sphinx_js/typedoc.py", line 324, in convert_node
    self.convert_node(child)
  File "/usr/local/lib/python3.6/dist-packages/sphinx_js/typedoc.py", line 324, in convert_node
    self.convert_node(child)
  File "/usr/local/lib/python3.6/dist-packages/sphinx_js/typedoc.py", line 291, in convert_node
    type = self.make_type(node['getSignature']['type'])
TypeError: list indices must be integers or slices, not str
ocket8888 commented 5 years ago

If there's any way to just use the project JSON file that typedoc can generate, I'd be happy to give that a whirl instead of generating it on-the-fly. A lot of the relative path stuff seems broken.

ocket8888 commented 5 years ago

After some investigation, it appears that this is the same issue as #90 . However, no release with that fix currently exists, so I'm gonna leave this open until a release including the fix is created.

clayrisser commented 5 years ago

I am getting the same error

clayrisser commented 5 years ago

Any temporary workarounds?

clayrisser commented 5 years ago

The issue seems to have been fixed, but the latest release not not have the fix.

https://github.com/mozilla/sphinx-js/blob/master/sphinx_js/typedoc.py#L327

ocket8888 commented 5 years ago

Project appears to be dead, the only "temporary workaround" I can think of is actually just forking the repo and applying it yourself.

clayrisser commented 5 years ago

@ocket8888 what project appears to be dead?

erikrose commented 4 years ago

Fixed in 913ff199f58e45745ef4c0bd5b616667d3aecaff.