Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Maverick's TypeScript Snippets
{
/*
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
// normal loop
"For Loop": {
"prefix": "forl",
"body": [
"for (let i = 0; i < input.length; i++) {",
"\t$0",
"}"
],
"description": "For Loop"
},
//reverse loop
"Forr Loop": {
"prefix": "forr",
"body": [
"for (let ${1:i} = input.length - 1; ${1:i} >= ${2:0}; ${1:i}--) {",
"\t$0",
"}"
],
"description": "Forr Loop"
},
// for-of loop
"For-of Loop": {
"prefix": "forof",
"body": [
"for (let row of input) {",
"\t$0",
"}"
],
"description": "For-of Loop JS"
},
//console
"console": {
"prefix": "conl",
"body": [
"console.log($0)"
],
"description": "console"
},
//if statement
"if": {
"prefix": "ifs",
"body": [
"if ($0) {",
"\t",
"}"
],
"description": "if statement"
},
//else if statement
"else if": {
"prefix": "eif",
"body": [
" else if ($0) {",
"\t",
"}"
],
"description": "else if statement"
},
//else statement
"else": {
"prefix": "els",
"body": [
" else {",
"\t$0",
"}"
],
"description": "else statement"
},
//length
"length": {
"prefix": "len",
"body": [
"length",
],
"description": "length auto complete"
},
//function
"function": {
"prefix": "func",
"body": [
"function ${1:solution}(input: any): void {",
"\t$0",
"}",
// "${1:name}([",
// "\t$0",
// "]);"
],
"description": "function"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.