简体   繁体   中英

Visual Studio Code Javascript Intellisense not working on event object properties

I noticed when trying to call the.target property on the event parameter i'm passing thru, the intellisense doesn't recognize and give me options of the available properties or methods.

Is this normal functionality or is there a way to work around this?

https://i.stack.imgur.com/7rN04.png

You should be able to make it work by using JSDoc type annotations:

/**
 * @param event {YourTypeHere}
 */
let sharePhoto = function (event) {
    // TODO: Write code
}

For example, if you type Event in between the brackets:

Visual Studio Code 屏幕截图显示 IntelliSense 在为“事件”提供“事件”类型注释后起作用

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