File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * This file provides type augmentations to fix build errors caused by
3+ * 'minizlib' v3 and 'tar' v7 requiring newer Node.js type definitions
4+ * than what is currently installed (@types/node@18).
5+ *
6+ * 1. 'minizlib' v3 references 'ZstdCompress' and 'ZstdDecompress' which
7+ * were added in newer Node.js versions (or drafts) and are missing
8+ * in @types/node@18.
9+ * 2. 'tar' v7 uses a generic 'Buffer<T>' type which was introduced in
10+ * TypeScript 5.7+ / newer @types/node, but our environment sees
11+ * 'Buffer' as non-generic.
12+ */
13+
14+ // Ensure this file is treated as a module
15+ export { } ;
16+
17+ // Fix for minizlib: "Namespace 'zlib' has no exported member 'ZstdCompress'"
18+ declare module 'zlib' {
19+ interface ZstdCompress {
20+ // Minimal interface to satisfy the type checker
21+ close ( ) : void ;
22+ }
23+ interface ZstdDecompress {
24+ // Minimal interface to satisfy the type checker
25+ close ( ) : void ;
26+ }
27+ }
28+
29+ // Fix for tar: "Type 'Buffer' is not generic."
30+ // We need to make Buffer generic in the global scope to match what tar expects.
31+ declare global {
32+ // eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-explicit-any
33+ interface Buffer < T = any > extends Uint8Array {
34+ // This merges with the existing Buffer interface and adds the generic parameter
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments