Skip to content

Example of using globals + namespace + interface #209

Open
@basickarl

Description

@basickarl

Hello! I'm trying to convert my TypeScript to JavaScript + JSDoc but can't seem to get around some things. Unfortunately the examples on more advanced JSDoc are pretty scarce, I'm wondering if anyone could help translate the following into JSDoc:

declare global {
    namespace jest {
        interface Matchers<R> {
            toBeWithMessage(result: boolean, message: string): R;
        }
    }
}

I've so far:

/**
 * @namespace jest
 */

/**
 * @interface Matchers
 * @memberof jest
 */

/**
 * @function
 * @name Matchers#toBeWithMessage
 * @param {boolean} result
 * @param {string} message
 */

Or is it correct? Unfortunetly TypeScript oes not support @interface or any other advanced features https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html as stated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions