How to modify variable js type through a js function

Answered

for example:

let arr=[]
arr.push({name:1})

I want to add [{name: 1}] jstype for arr

Make arr[0].<caret> will completion  name property

 

Which extension point should I use?

0
6 comments

Hi,

I'm sorry, but your use case is unclear. Do you want to add `{name: 1}` to array automatically? If yes, then how? By invoking something?

Or is it only about completing name, when such an object with name property exists in array (no adding is needed).

0

Yes, but i don't know which api to invoke

0

Hi,

I still don't understand which option you mean. I gave you two options to choose from, and you answered "yes".

Please describe the use case in detail (it is required when creating any topic on the forum).

0

option 1 , In short, I want to add additional JSType for qualified JSExpression

0

Hi,

If you want to insert an element to the array, then you can do it by modifying code PSI. See:

https://plugins.jetbrains.com/docs/intellij/modifying-psi.html

0

Please sign in to leave a comment.