Skip to content

Instantly share code, notes, and snippets.

@alexsasharegan
Created April 3, 2018 21:00
Show Gist options
  • Save alexsasharegan/5e199a5e4f018ab41099433288ca406c to your computer and use it in GitHub Desktop.
Save alexsasharegan/5e199a5e4f018ab41099433288ca406c to your computer and use it in GitHub Desktop.
Typescript snippets
{
"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