-
Notifications
You must be signed in to change notification settings - Fork 175
style(event-handler): apply stricter linting #4578
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
Changes from 5 commits
bc527d3
3b89362
7311816
e3759c5
2c2ef47
6ae3368
167c4ec
bf576e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ type ErrorHandler<T extends Error = Error> = ( | |
) => Promise<HandlerResponse>; | ||
|
||
interface ErrorConstructor<T extends Error = Error> { | ||
// biome-ignore lint/suspicious/noExplicitAny: this is a generic type that is intentionally open | ||
new (...args: any[]): T; | ||
prototype: T; | ||
} | ||
|
@@ -53,11 +54,11 @@ interface CompiledRoute { | |
|
||
type DynamicRoute = Route & CompiledRoute; | ||
|
||
type HandlerResponse = Response | JSONObject; | ||
type HandlerResponse = Response | JSONObject | undefined; | ||
|
||
type RouteHandler<TReturn = HandlerResponse> = ( | ||
reqCtx: RequestContext | ||
) => Promise<TReturn>; | ||
) => Promise<TReturn> | TReturn; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice |
||
|
||
type HttpMethod = keyof typeof HttpVerbs; | ||
|
||
|
@@ -78,12 +79,16 @@ type RestRouteOptions = { | |
middleware?: Middleware[]; | ||
}; | ||
|
||
type NextFunction = () => Promise<HandlerResponse | void>; | ||
type NextFunction = () => | ||
|
||
| Promise<HandlerResponse> | ||
| HandlerResponse | ||
| Promise<void> | ||
| void; | ||
|
||
type Middleware = (args: { | ||
reqCtx: RequestContext; | ||
next: NextFunction; | ||
}) => Promise<void | HandlerResponse>; | ||
}) => NextFunction; | ||
|
||
type RouteRegistryOptions = { | ||
/** | ||
|
@@ -176,4 +181,5 @@ export type { | |
RouteRegistryOptions, | ||
ValidationResult, | ||
CompressionOptions, | ||
NextFunction, | ||
}; |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@svozza @dreamorosi Can we narrow this down to something? I wasn't sure if we could
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the issue here is supporting custom error types, which can have arbitrary parameters when constructed: