@fluidframework/telemetry-utils 2.12.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/logger.ts CHANGED
@@ -289,11 +289,10 @@ export abstract class TelemetryLogger implements ITelemetryLoggerExt {
289
289
  }
290
290
  for (const props of properties) {
291
291
  if (props !== undefined) {
292
- for (const key of Object.keys(props)) {
292
+ for (const [key, getterOrValue] of Object.entries(props)) {
293
293
  if (eventLike[key] !== undefined) {
294
294
  continue;
295
295
  }
296
- const getterOrValue = props[key];
297
296
  // If this throws, hopefully it is handled elsewhere
298
297
  const value =
299
298
  typeof getterOrValue === "function" ? getterOrValue() : getterOrValue;
@@ -326,8 +325,7 @@ export class TaggedLoggerAdapter implements ITelemetryBaseLogger {
326
325
  category: eventWithTagsMaybe.category,
327
326
  eventName: eventWithTagsMaybe.eventName,
328
327
  };
329
- for (const key of Object.keys(eventWithTagsMaybe)) {
330
- const taggableProp = eventWithTagsMaybe[key];
328
+ for (const [key, taggableProp] of Object.entries(eventWithTagsMaybe)) {
331
329
  const { value, tag } =
332
330
  typeof taggableProp === "object"
333
331
  ? taggableProp
@@ -944,7 +942,6 @@ export const tagData = <
944
942
  // The ternary form is less legible in this case.
945
943
  // eslint-disable-next-line unicorn/prefer-ternary
946
944
  if (typeof value === "function") {
947
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
948
945
  pv[key] = () => {
949
946
  return { tag, value: value() };
950
947
  };
package/src/mockLogger.ts CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  type ITelemetryBaseEvent,
8
8
  type ITelemetryBaseLogger,
9
9
  LogLevel,
10
+ type Tagged,
10
11
  } from "@fluidframework/core-interfaces";
11
12
  import { assert } from "@fluidframework/core-utils/internal";
12
13
 
@@ -15,6 +16,7 @@ import type {
15
16
  ITelemetryEventExt,
16
17
  ITelemetryLoggerExt,
17
18
  ITelemetryPropertiesExt,
19
+ TelemetryEventPropertyTypeExt,
18
20
  } from "./telemetryTypes.js";
19
21
 
20
22
  /**
@@ -334,7 +336,10 @@ function matchObjects(
334
336
  expected: ITelemetryPropertiesExt,
335
337
  ): boolean {
336
338
  for (const [expectedKey, expectedValue] of Object.entries(expected)) {
337
- const actualValue = actual[expectedKey];
339
+ const actualValue:
340
+ | TelemetryEventPropertyTypeExt
341
+ | Tagged<TelemetryEventPropertyTypeExt>
342
+ | undefined = actual[expectedKey];
338
343
  if (
339
344
  !Array.isArray(expectedValue) &&
340
345
  expectedValue !== null &&