chore: inline type literals

This commit is contained in:
Daniel Roe 2024-09-11 10:25:42 +01:00
parent 16217ad579
commit 9b396ac084
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B
1 changed files with 1 additions and 2 deletions

View File

@ -1,7 +1,6 @@
import type { Nitro, NitroDevEventHandler, NitroEventHandler } from 'nitropack' import type { Nitro, NitroDevEventHandler, NitroEventHandler } from 'nitropack'
import type { Import } from 'unimport' import type { Import } from 'unimport'
import { normalize } from 'pathe' import { normalize } from 'pathe'
import type { HTTPMethod } from 'h3'
import { useNuxt } from './context' import { useNuxt } from './context'
import { toArray } from './utils' import { toArray } from './utils'
@ -13,7 +12,7 @@ function normalizeHandlerMethod (handler: NitroEventHandler) {
// retrieve method from handler file name // retrieve method from handler file name
const [, method = undefined] = handler.handler.match(/\.(get|head|patch|post|put|delete|connect|options|trace)(\.\w+)*$/) || [] const [, method = undefined] = handler.handler.match(/\.(get|head|patch|post|put|delete|connect|options|trace)(\.\w+)*$/) || []
return { return {
method: method as HTTPMethod, method: method as 'get' | 'head' | 'patch' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace',
...handler, ...handler,
handler: normalize(handler.handler), handler: normalize(handler.handler),
} }