Refactor imports and update type definitions in Realtime module

- Removed unnecessary import of `MessageEvent` from `@nestjs/common` in `realtime.types.ts`.
- Updated `realtime.pubsub.ts` to import `OnModuleDestroy` and `OnModuleInit` as types, improving clarity and consistency in type usage.
- Added a note in `realtime.types.ts` to clarify the non-generic nature of `MessageEvent` in the current setup, ensuring better understanding of shared type definitions.
This commit is contained in:
barsa 2025-12-15 11:11:17 +09:00
parent e1c8b6c15e
commit e1bdae08bd
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import { Inject, Injectable, Logger, OnModuleDestroy, OnModuleInit } from "@nestjs/common";
import { Inject, Injectable, Logger } from "@nestjs/common";
import type { OnModuleDestroy, OnModuleInit } from "@nestjs/common";
import { Redis } from "ioredis";
import { getErrorMessage } from "@bff/core/utils/error.util.js";
import type { RealtimePubSubMessage } from "./realtime.types.js";

View File

@ -1,5 +1,3 @@
import type { MessageEvent } from "@nestjs/common";
export interface RealtimeEventEnvelope<TEvent extends string = string, TData = unknown> {
event: TEvent;
data: TData;
@ -32,4 +30,5 @@ export interface RealtimeStreamOptions {
heartbeatEvent?: string | null;
}
export type RealtimeMessageEvent = MessageEvent<RealtimeEventEnvelope>;
// Note: NestJS MessageEvent is not a generic type in our setup (verbatimModuleSyntax + current Nest types).
// Keep this file purely as shared shape definitions.