Skip to content

Commit

Permalink
feat: add Typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
frani committed Jul 3, 2024
1 parent dc360b2 commit 2397e33
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"keywords": [
"nodejs",
"javascript",
"typescript",
"fractals",
"fractal",
"fractal pattern",
Expand All @@ -32,6 +33,10 @@
{
"language": "javascript",
"path": "./snippets/fractal.json"
},
{
"language": "yypescript",
"path": "./snippets/fractal.yypescript.json"
}
]
}
Expand Down
35 changes: 35 additions & 0 deletions snippets/fractal.typescript.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"fratal function snippet": {
"prefix": "ffs",
"body": [
"const ${1:name} = async (${2:input}): FractalResponse<${3:any}> => {",
" const payload: FractalResponse = { success: false, data: null, message: '', error: null };",
" try {",
" $0",
"",
" payload.success = true;",
" payload.data = data;",
" return payload;",
" } catch (error) {",
" payload.success = false;",
" payload.data = null;",
" payload.error = error",
" return payload;",
" }",
"};"
],
"description": "Create a Function with Fractal Pattern for Typescript"
},
"fratal response type": {
"prefix": "ffstype",
"body": [
"Interface FractalResponse<T = any> {",
" success: boolean;",
" data: T | null;",
" message: string;",
" error: any | null;",
"}"
],
"description": "Create a Function with Fractal Pattern for Typescript"
}
}

0 comments on commit 2397e33

Please sign in to comment.