Skip to content

Commit 413fea5

Browse files
vercel[bot]molebox
andcommitted
Fix: Missing detectionMethod property in TrackMdRequestParams type causes TypeScript compilation error and build failure.
This commit fixes the issue reported at apps/docs/lib/geistdocs/md-tracking.ts:24 **Bug explanation:** The `trackMdRequest` function in `apps/docs/lib/geistdocs/md-tracking.ts` destructures `detectionMethod` from its parameter (line 24) and includes it in the JSON body sent to the tracking endpoint (line 38). However, the `TrackMdRequestParams` type definition (lines 6-12) does not include `detectionMethod` as a property. In `apps/docs/proxy.ts` (line 82-87), `trackMdRequest` is called with `detectionMethod: agentResult.method` when an AI agent is detected, where `agentResult.method` is of type `DetectionMethod | null` from `@/lib/ai-agent-detection`. This causes an exact TypeScript compilation error confirmed in the build logs: ``` ./lib/geistdocs/md-tracking.ts:24:3 Type error: Property 'detectionMethod' does not exist on type 'TrackMdRequestParams'. ``` This error causes the entire `docs` build to fail (`next build` exits with code 1). **Fix explanation:** Added `detectionMethod?: DetectionMethod | null` as an optional property to the `TrackMdRequestParams` type, and added the corresponding `import type { DetectionMethod } from "@/lib/ai-agent-detection"` import at the top of the file. The property is optional (`?`) because most call sites (for `.md` URL tracking, `llms.txt` tracking, and header-negotiated tracking) don't pass a `detectionMethod` — only the agent-rewrite tracking path does. The `| null` union matches the `DetectionResult.method` type from `ai-agent-detection.ts`. Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com> Co-authored-by: molebox <hello@richardhaines.dev>
1 parent 29a464a commit 413fea5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

apps/docs/lib/geistdocs/md-tracking.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { siteId } from "@/geistdocs";
2+
import type { DetectionMethod } from "@/lib/ai-agent-detection";
23

34
const PLATFORM_URL = "https://geistdocs.com/md-tracking";
45

@@ -9,6 +10,8 @@ type TrackMdRequestParams = {
910
acceptHeader: string | null;
1011
/** How the markdown was requested: 'md-url' for direct .md URLs, 'header-negotiated' for Accept header */
1112
requestType?: "md-url" | "header-negotiated" | "agent-rewrite";
13+
/** Which detection method identified the AI agent */
14+
detectionMethod?: DetectionMethod | null;
1215
};
1316

1417
/**

0 commit comments

Comments
 (0)