Skip to content

Commit d6f4452

Browse files
G4brymclaude
andcommitted
fix: resolve TS2339 for Error.captureStackTrace in DTS build
V8-specific captureStackTrace is not in standard TS lib types. Cast through unknown to satisfy strict type checking during DTS generation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ee5a83c commit d6f4452

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/errors.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ export class QueryBuilderError extends Error {
5252

5353
this.message = enhancedMessage
5454

55-
// Maintains proper stack trace for where our error was thrown
56-
if (Error.captureStackTrace) {
57-
Error.captureStackTrace(this, QueryBuilderError)
55+
// Maintains proper stack trace for where our error was thrown (V8 engines)
56+
const ErrorWithCapture = Error as unknown as { captureStackTrace?: (target: object, constructor: Function) => void }
57+
if (ErrorWithCapture.captureStackTrace) {
58+
ErrorWithCapture.captureStackTrace(this, QueryBuilderError)
5859
}
5960
}
6061
}

0 commit comments

Comments
 (0)