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

TypeScript overloads fail #110

Closed tavianator closed 4 years ago

tavianator commented 5 years ago

The following example:

function foo(bar: number): number;
function foo(bar: string): string;

function foo(bar: number | string): number | string {
    return bar;
}

Generates this error:

Exception occurred:
  File ".../site-packages/sphinx_js/doclets.py", line 49, in gather_doclets
    raise PathsTaken(conflicts)
sphinx_js.doclets.PathsTaken: Your JS code contains multiple documented objects at each of these paths:

  ./docs/foo.external:foo.foo

We won't know which one you're talking about. Using JSDoc tags like @class might help you differentiate them.
erikrose commented 4 years ago

In the IR branch, I am arbitrarily just taking the first signature now. That ought to get it not crashing. Later, we can figure out how to show all the signature or choose among them or whatever.

erikrose commented 4 years ago

It doesn't fail anymore, but the ticket about showing all of them is #152. Cheers!