简体   繁体   中英

Custom typeScript snippets for VSCode

It is possible to create custom user snippets in vs code. But is it possible to create them in detail for ts functions like:

someArray.forEach((val: getTypeFromArrayOnTheFly){

}

I did manage to create a basic snippet, but have no clue how to display it after writing an arrayName with dot. And also how to get the type from the array i want to use the snippet on.

Typescript Language Basics already defines the snippet foreach => which expands to

array.forEach(element => {
  
});

Since the type of array should be known, you don't need to define the type of element .

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