Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(search-bar): unbreak web build — type error in observedMetadataStore test (LFE-10666) (#14777)

Nikita Kabardin7c090ab2db1a
diff --git a/web/src/features/search-bar/store/observedMetadataStore.clienttest.ts b/web/src/features/search-bar/store/observedMetadataStore.clienttest.ts
index 5b89979ab6..dcc027df6f 100644
--- a/web/src/features/search-bar/store/observedMetadataStore.clienttest.ts
+++ b/web/src/features/search-bar/store/observedMetadataStore.clienttest.ts
@@ -176,17 +176,17 @@ describe("mergeIntoProject", () => {
it("types keys shadowing Object.prototype members correctly", () => {
// `nextPaths["toString"]` must not read the inherited function as the
// "existing" entry — that would skip the cap counter and pin the type to
- // "mixed" forever (review find: greptile/claude on PR #14771).
- const merged = mergeIntoProject(
- {},
- "p1",
- paths({
- toString: { type: "string", values: ["hello"] },
- constructor: { type: "number", values: ["1"] },
- hasOwnProperty: { type: "boolean" },
- }),
- 1000,
- );
+ // "mixed" forever (review find: greptile/claude on PR #14771). Built from
+ // tuples, not an object literal: TS contextual typing breaks on literal
+ // properties named after Object.prototype members (the values widen to
+ // `string` and fail assignability — broke the `next build` type pass,
+ // which unlike tsconfig.build.json includes clienttest files).
+ const shadowing = new Map<string, StoredKeyInfo>([
+ ["toString", { type: "string", values: ["hello"] }],
+ ["constructor", { type: "number", values: ["1"] }],
+ ["hasOwnProperty", { type: "boolean" }],
+ ]);
+ const merged = mergeIntoProject({}, "p1", shadowing, 1000);
expect(merged?.p1.paths.toString).toEqual({
type: "string",
values: ["hello"],
@@ -201,7 +201,9 @@ describe("mergeIntoProject", () => {
mergeIntoProject(
merged!,
"p1",
- paths({ toString: { type: "string", values: ["hello"] } }),
+ new Map<string, StoredKeyInfo>([
+ ["toString", { type: "string", values: ["hello"] }],
+ ]),
2000,
),
).toBe(null);