简体   繁体   中英

vscode and jsdocs - How to use TS interfaces or types for javascript functions

I know that a type or an interface can be used for intellisensing function params or inline @type 's. But is there some way to use types/interfaces to give intellisense to whole functions or object literals? Example:

type TFunc = ( x: number ) => boolean;

/**
 * @implements {TFunc}
 */
function isNumber ( x ) {
    return typeof x === 'number';
}

@implements doesn't work. I wonder if that can be done in another way?

I would say:

Use @type rather than @implements

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM