diff --git a/new-log-viewer/src/services/decoders/JsonlDecoder/index.ts b/new-log-viewer/src/services/decoders/JsonlDecoder/index.ts index c6c4aa92..fc92be3e 100644 --- a/new-log-viewer/src/services/decoders/JsonlDecoder/index.ts +++ b/new-log-viewer/src/services/decoders/JsonlDecoder/index.ts @@ -73,7 +73,7 @@ class JsonlDecoder implements Decoder { build (): LogEventCount { this.#deserialize(); - const numInvalidEvents = Array.from(this.#invalidLogEventIdxToRawLine.keys()).length; + const numInvalidEvents = this.#invalidLogEventIdxToRawLine.size; return { numValidEvents: this.#logEvents.length - numInvalidEvents, @@ -106,9 +106,8 @@ class JsonlDecoder implements Decoder { const results: DecodeResultType[] = []; for (let i = beginIdx; i < endIdx; i++) { - // Explicit cast since typescript thinks `#filteredLogEventMap[i]` - // can be undefined, but it shouldn't be since we performed a bounds check at the - // beginning of the method. + // Explicit cast since typescript thinks `#filteredLogEventMap[i]` can be undefined, but + // it shouldn't be since we performed a bounds check at the beginning of the method. const logEventIdx: number = (useFilter && null !== this.#filteredLogEventMap) ? (this.#filteredLogEventMap[i] as number) : i; diff --git a/new-log-viewer/src/typings/logs.ts b/new-log-viewer/src/typings/logs.ts index 8f32e65f..67fe98fe 100644 --- a/new-log-viewer/src/typings/logs.ts +++ b/new-log-viewer/src/typings/logs.ts @@ -16,14 +16,14 @@ enum LOG_LEVEL { type LogLevelFilter = Nullable; -const INVALID_TIMESTAMP_VALUE = 0; - interface LogEvent { timestamp: Dayjs, level: LOG_LEVEL, fields: JsonObject } +const INVALID_TIMESTAMP_VALUE = 0; + export type { LogEvent, LogLevelFilter,