Skip to content

HEAD reported as an invalid request handler #9468

Closed
@poppa

Description

@poppa

Describe the bug

VS Code is reporting exporting a HEAD request handler with the following error:

Invalid export 'HEAD' (valid exports are prerender, trailingSlash, config, GET, POST, PUT, PATCH, DELETE, OPTIONS, or anything with a '_' prefix)ts(71001)

Screenshot 2023-03-21 at 10 18 11

The HEAD handler is properly called when a HEAD request is issued, and svelte-check doesn't complain about it either, so my guess is that this is an error related to the language tools.

I also noted that HEAD is not listed as a valid verb at the documentation (https://kit.svelte.dev/docs/routing#server)

Reproduction

export const HEAD = (() => new Response(null, { status: 200 })) satisfies RequestHandler

Expected behaviour

I don't expect an error here

System Info

  • Svelte v3.57.0
  • SvelteKit v1.13
  • Svelte Check v3.1.4
  • Svelte for VS Code v107.2.5
  • VSCode
    Version: 1.76.2
    Commit: ee2b180d582a7f601fa6ecfdad8d9fd269ab1884
    Date: 2023-03-14T17:54:09.061Z
    Electron: 19.1.11
    Chromium: 102.0.5005.196
    Node.js: 16.14.2
    V8: 10.2.154.26-electron.0
    OS: Darwin x64 22.1.0
    Sandboxed: Yes

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions