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 interface renders as 'class' #118

Closed Eotia-was-taken closed 5 years ago

Eotia-was-taken commented 5 years ago

Hey guys, yesterday I started using your generation tool for a project. Sadly I have found a few problems when trying to apply it to our TypeScript project. I have formulated some fixes for the direct problems I had and will post a PR about those. One problem I cannot ascertain is why my interfaces get rendered as class even though it states one line further that it was marked as an interface.

Kind regards Maxim

Please see the screenshot for reference. The corresponding code is:

/**
 * A super cool interface.
 */
export interface SuperCoolInterface {
    init (
        higherOrderFunction:(request: number) => Promise<Promise<number[]>>): Promise<void>;

    /**
     * super important function
     * @param response totally legit number parameter
     */
    importantFunction(response: number): Promise<void| number>;
}
Screenshot 2019-09-26 at 11 41 35
erikrose commented 5 years ago

It's likely because the underlying Sphinx constructs that our directives emit have only a "class" type: https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html?highlight=javascript#the-javascript-domain. To get it to say "interface" instead, we'd have to punch down a level of abstraction.

Eotia-was-taken commented 5 years ago

Thank you I did not know that the Sphinx constructs does not include an interface type. Still really new in the usage of this tool. Thank you for your help. Should I keep this open?

erikrose commented 5 years ago

Only if you're planning to work on it. I'm probably not going to get to it myself.