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

unhandled case in typedoc processing #167

Open
dealsumm opened this issue Jan 12, 2021 · 3 comments
Open

unhandled case in typedoc processing #167

dealsumm opened this issue Jan 12, 2021 · 3 comments

Comments

@dealsumm
Copy link

I'm trying to run sphinx-js on a react typesctipt project.
running sphinx-build -v -b html -d _build/doctrees . _build/html
I get the following exception traceback:

File "/usr/local/lib/python3.8/site-packages/sphinx/events.py", line 110, in emit
    results.append(listener.handler(self.app, *args))
  File "/usr/local/lib/python3.8/site-packages/sphinx_js/__init__.py", line 60, in analyze
    app._sphinxjs_analyzer = analyzer.from_disk(abs_source_paths,
  File "/usr/local/lib/python3.8/site-packages/sphinx_js/typedoc.py", line 40, in from_disk
    return cls(json, base_dir)
  File "/usr/local/lib/python3.8/site-packages/sphinx_js/typedoc.py", line 29, in __init__
    ir_objects = self._convert_all_nodes(json)
  File "/usr/local/lib/python3.8/site-packages/sphinx_js/typedoc.py", line 113, in _convert_all_nodes
    converted, more_todo = self._convert_node(todo.pop())
  File "/usr/local/lib/python3.8/site-packages/sphinx_js/typedoc.py", line 166, in _convert_node
    **self._top_level_properties(node))
  File "/usr/local/lib/python3.8/site-packages/sphinx_js/typedoc.py", line 65, in _top_level_properties
    source = node.get('sources')[0]
TypeError: 'NoneType' object is not subscriptable

I'm not sure if the cause is something I did incorrect or if it's a case that is not covered in the typedoc implementation.

@erikrose
Copy link
Contributor

Don't worry; it's not your fault. However, I'd be curious if it works under TypeDoc 0.15.0, which is the latest version we've tested with.

@nagmo
Copy link

nagmo commented Jan 14, 2021

@erikrose thanks, I've tested it with typedoc version 0.15.0 and it has the same exact issue.
do you have a suggestion for a quick fix until the issue is resolved?

@erikrose
Copy link
Contributor

Unfortunately not. First of all, we shouldn't be saying node.get('sources')[0]; we might as well say node['sources'][0] and crash a little earlier. But that's a nitpick. This 'source' key is a vital thing, so there's no obvious way to paper over it. I wonder _top_level_properties is getting passed the wrong thing somehow. Can you reduce your code to the smallest bit that will trigger the error and share it?

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

No branches or pull requests

3 participants