Skip to content

Commit

Permalink
fix(types): mark peer.request as always defined
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 22, 2025
1 parent e915f8d commit 8fbb59b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/adapters/cloudflare-durable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default defineWebSocketAdapter<

class CloudflareDurablePeer extends Peer<{
ws: AugmentedWebSocket;
request?: Request;
request: Request;
peers?: never;
durable: DurableObjectPub;
}> {
Expand Down
4 changes: 2 additions & 2 deletions src/peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { UpgradeRequest } from "./hooks.ts";

export interface AdapterInternal {
ws: unknown;
request?: UpgradeRequest;
request: UpgradeRequest;
peers?: Set<Peer>;
context?: Peer["context"];
}
Expand Down Expand Up @@ -41,7 +41,7 @@ export abstract class Peer<Internal extends AdapterInternal = AdapterInternal> {
}

/** upgrade request */
get request(): UpgradeRequest | undefined {
get request(): UpgradeRequest {
return this._internal.request;
}

Expand Down

0 comments on commit 8fbb59b

Please sign in to comment.