From: Yadd <yadd@debian.org>
Date: Thu, 1 Aug 2024 09:28:06 +0000
Subject: tsc workarounds

Forwarded: not-needed
Last-Update: 2023-11-11
---
 packages/degenerator/src/compile.ts     | 10 ++++++++++
 packages/degenerator/src/degenerator.ts |  5 +++++
 packages/get-uri/tsconfig.json          |  3 ++-
 packages/https-proxy-agent/src/index.ts |  1 +
 packages/https-proxy-agent/test/test.ts |  1 +
 packages/socks-proxy-agent/src/index.ts |  1 +
 packages/tsconfig/base.json             |  3 +--
 7 files changed, 21 insertions(+), 3 deletions(-)

--- a/packages/degenerator/src/compile.ts
+++ b/packages/degenerator/src/compile.ts
@@ -68,20 +68,30 @@
 			resolvedHandle = vm.unwrapResult(resolvedResult);
 			return quickJSHandleToHost(vm, resolvedHandle);
 		} catch (err: unknown) {
+// @ts-ignore
 			if (err && typeof err === 'object' && 'cause' in err && err.cause) {
 				if (
+// @ts-ignore
 					typeof err.cause === 'object' &&
+// @ts-ignore
 					'stack' in err.cause &&
+// @ts-ignore
 					'name' in err.cause &&
+// @ts-ignore
 					'message' in err.cause &&
+// @ts-ignore
 					typeof err.cause.stack === 'string' &&
+// @ts-ignore
 					typeof err.cause.name === 'string' &&
+// @ts-ignore
 					typeof err.cause.message === 'string'
 				) {
 					// QuickJS Error `stack` does not include the name +
 					// message, so patch those in to behave more like V8
+// @ts-ignore
 					err.cause.stack = `${err.cause.name}: ${err.cause.message}\n${err.cause.stack}`;
 				}
+// @ts-ignore
 				throw err.cause;
 			}
 			throw err;
--- a/packages/degenerator/src/degenerator.ts
+++ b/packages/degenerator/src/degenerator.ts
@@ -33,6 +33,7 @@
 	let lastNamesLength = 0;
 	do {
 		lastNamesLength = names.length;
+// @ts-ignore
 		visit(ast, {
 			visitVariableDeclaration(path) {
 				if (path.node.declarations) {
@@ -83,7 +84,9 @@
 					path.node.async = true;
 
 					// Add function name to `names` array
+// @ts-ignore
 					if (!checkName(path.node.id.name, names)) {
+// @ts-ignore
 						names.push(path.node.id.name);
 					}
 				}
@@ -95,6 +98,7 @@
 
 	// Second pass is for adding `await` statements to any function
 	// invocations that match the given `names` array.
+// @ts-ignore
 	visit(ast, {
 		visitCallExpression(path) {
 			if (checkNames(path.node, names)) {
@@ -150,6 +154,7 @@
 		}
 	} else if (n.FunctionExpression.check(callee)) {
 		if (callee.id) {
+// @ts-ignore
 			name = callee.id.name;
 		} else {
 			return false;
--- a/packages/get-uri/tsconfig.json
+++ b/packages/get-uri/tsconfig.json
@@ -8,7 +8,7 @@
     "outDir": "dist",
     "sourceMap": true,
     "declaration": true,
-    "typeRoots": ["./@types", "./node_modules/@types"]
+    "typeRoots": ["./@types", "./node_modules/@types", "../../node_modules/@types"]
   },
   "include": ["src/**/*"],
   "exclude": ["node_modules"]
--- a/packages/https-proxy-agent/src/index.ts
+++ b/packages/https-proxy-agent/src/index.ts
@@ -150,6 +150,7 @@
 
 		const { connect, buffered } = await proxyResponsePromise;
 		req.emit('proxyConnect', connect);
+// @ts-ignore
 		this.emit('proxyConnect', connect, req);
 
 		if (connect.statusCode === 200) {
--- a/packages/https-proxy-agent/test/test.ts
+++ b/packages/https-proxy-agent/test/test.ts
@@ -118,6 +118,7 @@
 			});
 
 			const r = req(serverUrl, { agent });
+// @ts-ignore
 			const [connect] = await once(agent, 'proxyConnect');
 			expect(connect.statusCode).toEqual(200);
 			expect(connect.statusText).toEqual('Connection established');
--- a/packages/socks-proxy-agent/src/index.ts
+++ b/packages/socks-proxy-agent/src/index.ts
@@ -150,6 +150,7 @@
 					if (err) {
 						reject(err);
 					} else {
+// @ts-ignore
 						resolve(res);
 					}
 				});
--- a/packages/tsconfig/base.json
+++ b/packages/tsconfig/base.json
@@ -8,7 +8,6 @@
     "forceConsistentCasingInFileNames": true,
     "sourceMap": true,
     "inlineSources": false,
-    "isolatedModules": true,
     "moduleResolution": "node",
     "noUnusedLocals": false,
     "noUnusedParameters": false,
