JSDOC - JS How do I overload a method?

Viewed 22

I'm struggling to document an overload to a method, though it works fine for object.

This works:

const test = {
    /** 
     * @type {{
     * (bar: string) => boolean
     * (bar: number) => string
     * }} 
     * */
    foo: (bar) => {
        // something...
    }
}

Code with working intellisense

Doesn't work:

class Test {
    /** 
     * @type {{
     * (bar: string) => boolean
     * (bar: number) => string
     * }} 
     * */
    foo(bar) {
        // something...
    }
}

Code with not working intellisense

0 Answers
Related