Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use satisfies in typescript snippets #1853

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions packages/svelte-vscode/snippets/typescript.json
Expand Up @@ -3,24 +3,30 @@
"prefix": "kitEndpoint",
"description": "SvelteKit Endpoint",
"body": [
"export const ${1|GET,POST,PUT,PATCH,DELETE|}: RequestHandler = async ($2) => {",
"export const ${1|GET,POST,PUT,PATCH,DELETE|} = (async ($2) => {",
"\t$3",
"\treturn new Response();",
"};"
"}) satisfies RequestHandler;"
]
},
"SvelteKit Actions": {
"prefix": "kitActions",
"description": "SvelteKit Actions",
"body": ["export const actions: Actions = {", "\t$1", "};"]
"body": [
"export const actions = {",
"\tasync ${1:default}($2) {",
"\t\t$3",
"\t}",
"} satisfies Actions;"
]
},
"SvelteKit Load": {
"prefix": "kitLoad",
"description": "SvelteKit Load",
"body": [
"export const load: ${1|PageLoad,PageServerLoad,LayoutLoad,LayoutServerLoad|} = async ($2) => {",
"export const load = (async ($2) => {",
"\t$3",
"};"
"}) satisfies ${1|PageLoad,PageServerLoad,LayoutLoad,LayoutServerLoad|};"
]
},
"SvelteKit Param Matcher": {
Expand All @@ -29,9 +35,9 @@
"body": [
"import type { ParamMatcher } from '@sveltejs/kit';",
"",
"export const match: ParamMatcher = (param) => {",
"export const match = ((param) => {",
"\treturn $1;",
"};"
"}) satisfies ParamMatcher;"
]
}
}