Skip to content

Commit 28f46ff

Browse files
committed
remove null check conditional when pushing to routesByMethod
1 parent 9c38149 commit 28f46ff

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/event-handler/src/rest/RouteHandlerRegistry.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ class RouteHandlerRegistry {
3030

3131
this.#routes.set(route.id, route);
3232

33-
if (!this.#routesByMethod.has(route.method)) {
34-
this.#routesByMethod.set(route.method, []);
35-
}
36-
// biome-ignore lint/style/noNonNullAssertion: Map.set operation above ensures Map.get won't return undefined
37-
this.#routesByMethod.get(route.method)!.push(route);
33+
const routesByMethod = this.#routesByMethod.get(route.method) ?? [];
34+
routesByMethod.push(route);
35+
this.#routesByMethod.set(route.method, routesByMethod);
3836
}
3937

4038
public getRouteCount(): number {

0 commit comments

Comments
 (0)