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

Fixes for typedoc ~0.22.11 and strange self-referencing variable issue #189

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Kelketek
Copy link

@Kelketek Kelketek commented Feb 9, 2022

This Pull request includes a fix from @semohr to resolve #166 and also resolves an issue that came up in this merge request where a node of type 'reference' did not exist in the index, but did have a 'name' key. This seems to be something that's cropped up in the new version of TypeDoc.

I've also added one additional change-- the ability to recognize literals as types for TypeDoc, so that things like null and 'name' or what have you don't show up as '<TODO: Other Type>'

Comment on lines 197 to 201
def rec_helper(node):
if "sources" in node["__parent"]:
return node["__parent"]["sources"]
else:
rec_helper(node["__parent"])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is styling, but how about

Suggested change
def rec_helper(node):
if "sources" in node["__parent"]:
return node["__parent"]["sources"]
else:
rec_helper(node["__parent"])
def rec_helper(node):
if "sources" not in node["__parent"]:
rec_helper(node["__parent"])
return node["__parent"]["sources"]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Come to think of it, there's an apparent bug in this code to start with. The recursive handling isn't returning at all-- this is getting ignored.

I pulled this from someone else's work. I'll modify it and see if anything changes.

Add ability to recognize literals as a type for TypeScript.
@Kelketek Kelketek force-pushed the fox/STAR-2263-typedoc-name-fix branch from 8ae0efd to ebf7597 Compare February 21, 2022 19:32
@Kelketek Kelketek changed the title [WIP] Fixes for typedoc ~0.22.11 and strange self-referencing variable issue Fixes for typedoc ~0.22.11 and strange self-referencing variable issue Feb 21, 2022
@willkg willkg added this to the 3.2 milestone Feb 23, 2022
sphinx_js/typedoc.py Outdated Show resolved Hide resolved
Change the recursive function call to a while loop.

Co-authored-by: Tavian Barnes <[email protected]>
@@ -328,6 +340,8 @@ def typedoc_output(abs_source_paths, sphinx_conf_dir, config_path):
with NamedTemporaryFile(mode='w+b') as temp:
command.add('--json', temp.name, *abs_source_paths)
try:
from pprint import pprint
pprint(command.make())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover debugging code?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Removed.

sphinx_js/typedoc.py Outdated Show resolved Hide resolved
@willkg willkg modified the milestones: 3.2.0, 3.next Dec 13, 2022
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

Successfully merging this pull request may close these issues.

Extension Error (exception: 'sources')
5 participants