Created
April 3, 2018 21:00
-
-
Save alexsasharegan/5e199a5e4f018ab41099433288ca406c to your computer and use it in GitHub Desktop.
Typescript snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"async function": { | |
"prefix": "afunc", | |
"body": [ | |
"async function ${1:name}($2) {", | |
"\t$3", | |
"}" | |
] | |
}, | |
"arrow function": { | |
"prefix": "afn", | |
"body": [ | |
"($1) => {", | |
"\t$2", | |
"}" | |
] | |
}, | |
"async arrow function": { | |
"prefix": "aafn", | |
"body": [ | |
"async ($1) => {", | |
"\t$2", | |
"}" | |
] | |
}, | |
"lambda function": { | |
"prefix": "lambda", | |
"body": "$1 => $2" | |
}, | |
"jest describe block": { | |
"prefix": "jdesc", | |
"body": [ | |
"describe(\"${1:MyUnit}\", () => {", | |
"\t$2", | |
"})" | |
] | |
}, | |
"jest it block": { | |
"prefix": "jit", | |
"body": [ | |
"it(\"should ${1:work}\", async () => {", | |
"\t${2:// 🔬}", | |
"})" | |
] | |
}, | |
"new Promise Executor": { | |
"prefix": "nprom", | |
"body": [ | |
"new Promise((resolve, reject) => {", | |
"\t$1", | |
"})" | |
] | |
}, | |
"class constructor": { | |
"prefix": "ctor", | |
"body": [ | |
"constructor(...args: any[]) {", | |
"\tsuper(...args);", | |
"\t$1", | |
"}" | |
] | |
}, | |
"doc heading": { | |
"prefix": "docbloc", | |
"body": [ | |
"/**", | |
" * -----------------------------------------------------------------------------", | |
" * $1", | |
" * -----------------------------------------------------------------------------", | |
" */", | |
] | |
}, | |
"disable spell checker": { | |
"prefix": "nospell", | |
"body": "/* spell-checker: disable */" | |
}, | |
"Backbone Model Constructor": { | |
"prefix": "bbmc", | |
"body": [ | |
"constructor(attributes?: any, options?: any) {", | |
"\t// @ts-ignore super must be called before accessing 'this'", | |
"\t$1", | |
"", | |
"\tsuper(attributes, options);", | |
"}", | |
] | |
}, | |
"Backbone Collection Constructor": { | |
"prefix": "bbcc", | |
"body": [ | |
"constructor(models?: ${1:TModel}[] | Object[], options?: any) {", | |
"\t// @ts-ignore super must be called before accessing 'this'", | |
"\t$2", | |
"", | |
"\tsuper(models, options);", | |
"}", | |
] | |
}, | |
"Backbone View Constructor": { | |
"prefix": "bbvc", | |
"body": [ | |
"constructor(options?: ViewOptions<${1:TModel}>) {", | |
"\t// @ts-ignore super must be called before accessing 'this'", | |
"\t$2", | |
"", | |
"\tsuper(options);", | |
"}", | |
] | |
}, | |
"Vuex mapX": { | |
"prefix": "vuexmap", | |
"body": [ | |
"...(<{${2:prop}($4): ${3:any}}>map${1:Getters}(['${2:prop}']))," | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment