Eddy White
Eddy White

Reputation: 1

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.

Upvotes: 0

Views: 324

Answers (1)

DustInComp
DustInComp

Reputation: 2666

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.

Upvotes: 2

Related Questions