Skip to content

Commit

Permalink
Revert #23583: Ineffective TypeScript type handling in telemetry utils (
Browse files Browse the repository at this point in the history
#23615)

The changes in #23583 for handling record access in telemetry utils
didn't achieve the intended type safety improvements. While they
satisfied linter rules, TypeScript still ignores `undefined`
possibilities, leaving type analysis in these situations potentially
untested.
  • Loading branch information
RishhiB authored Jan 21, 2025
1 parent 91f6fa9 commit 9509975
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions packages/utils/telemetry-utils/src/mockLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
type ITelemetryBaseEvent,
type ITelemetryBaseLogger,
LogLevel,
type Tagged,
} from "@fluidframework/core-interfaces";
import { assert } from "@fluidframework/core-utils/internal";

Expand All @@ -16,7 +15,6 @@ import type {
ITelemetryEventExt,
ITelemetryLoggerExt,
ITelemetryPropertiesExt,
TelemetryEventPropertyTypeExt,
} from "./telemetryTypes.js";

/**
Expand Down Expand Up @@ -332,10 +330,7 @@ function matchObjects(
expected: ITelemetryPropertiesExt,
): boolean {
for (const [expectedKey, expectedValue] of Object.entries(expected)) {
const actualValue:
| TelemetryEventPropertyTypeExt
| Tagged<TelemetryEventPropertyTypeExt>
| undefined = actual[expectedKey];
const actualValue = actual[expectedKey];
if (
!Array.isArray(expectedValue) &&
expectedValue !== null &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ const annotationCases: Record<string, IFluidErrorAnnotations> = {
describe("normalizeError", () => {
describe("Valid Errors (Legacy and Current)", () => {
for (const annotationCase of Object.keys(annotationCases)) {
const annotations: IFluidErrorAnnotations | undefined = annotationCases[annotationCase];
const annotations = annotationCases[annotationCase];
it(`Valid Fluid Error - untouched (annotations: ${annotationCase})`, () => {
// Arrange
const fluidError = new TestFluidError({ errorType: "et1", message: "m1" });
Expand Down

0 comments on commit 9509975

Please sign in to comment.