File: fix-prepareStackTrace-type.patch

package info (click to toggle)
node-webpack 5.97.1%2Bdfsg1%2B~cs11.18.27-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 59,064 kB
  • sloc: javascript: 185,073; makefile: 16; sh: 6
file content (71 lines) | stat: -rw-r--r-- 2,575 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 906627aadc04044060d9c0d446906c3aa2843de0 Mon Sep 17 00:00:00 2001
From: alexander-akait <sheo13666q@gmail.com>
Date: Tue, 6 May 2025 15:25:52 +0300
Subject: [PATCH] fix: type error with latest @types/node

---
--- a/types.d.ts
+++ b/types.d.ts
@@ -15474,20 +15474,56 @@
 	deserialize(__0: ObjectDeserializerContext): void;
 
 	/**
-	 * Create .stack property on a target object
+	 * Creates a `.stack` property on `targetObject`, which when accessed returns
+	 * a string representing the location in the code at which
+	 * `Error.captureStackTrace()` was called.
+	 * ```js
+	 * const myObject = {};
+	 * Error.captureStackTrace(myObject);
+	 * myObject.stack;  // Similar to `new Error().stack`
+	 * ```
+	 * The first line of the trace will be prefixed with
+	 * `${myObject.name}: ${myObject.message}`.
+	 * The optional `constructorOpt` argument accepts a function. If given, all frames
+	 * above `constructorOpt`, including `constructorOpt`, will be omitted from the
+	 * generated stack trace.
+	 * The `constructorOpt` argument is useful for hiding implementation
+	 * details of error generation from the user. For instance:
+	 * ```js
+	 * function a() {
+	 *   b();
+	 * }
+	 * function b() {
+	 *   c();
+	 * }
+	 * function c() {
+	 *   // Create an error without stack trace to avoid calculating the stack trace twice.
+	 *   const { stackTraceLimit } = Error;
+	 *   Error.stackTraceLimit = 0;
+	 *   const error = new Error();
+	 *   Error.stackTraceLimit = stackTraceLimit;
+	 *   // Capture the stack trace above function b
+	 *   Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
+	 *   throw error;
+	 * }
+	 * a();
+	 * ```
 	 */
 	static captureStackTrace(
 		targetObject: object,
 		constructorOpt?: Function
 	): void;
+	static prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
 
 	/**
-	 * Optional override for formatting stack traces
+	 * The `Error.stackTraceLimit` property specifies the number of stack frames
+	 * collected by a stack trace (whether generated by `new Error().stack` or
+	 * `Error.captureStackTrace(obj)`).
+	 * The default value is `10` but may be set to any valid JavaScript number. Changes
+	 * will affect any stack trace captured _after_ the value has been changed.
+	 * If set to a non-number value, or set to a negative number, stack traces will
+	 * not capture any frames.
 	 */
-	static prepareStackTrace?: (
-		err: Error,
-		stackTraces: NodeJS.CallSite[]
-	) => any;
 	static stackTraceLimit: number;
 }
 declare abstract class WebpackLogger {