diff --git a/declarations.d.ts b/declarations.d.ts
index 7f85b40..02c1b23 100644
--- a/declarations.d.ts
+++ b/declarations.d.ts
@@ -6,6 +6,7 @@ declare module "typescript" {
 	export function signatureHasRestParameter(signature: ts.Signature): boolean;
 	interface Symbol {
 		type?: ts.Type;
+		parent: Symbol | undefined
 	}
 	interface Declaration {
 		expression?: ts.Expression;
diff --git a/generate-types/index.js b/generate-types/index.js
index dc7e016..580c7bb 100644
--- a/generate-types/index.js
+++ b/generate-types/index.js
@@ -341,6 +341,24 @@ const printError = (diagnostic) => {
 		);
 	};
 
+	/**
+	 * @param {ts.Symbol} current current
+	 * @returns {string} full escaped name
+	 */
+	const getFullEscapedName = (current) => {
+		let name = current.escapedName.toString();
+		while (current.parent) {
+			current = current.parent;
+			if (
+				current.escapedName === undefined ||
+				current.escapedName.toString() === "__global"
+			)
+				break;
+			name = `${current.escapedName.toString()}.${name}`;
+		}
+		return name;
+	}
+
 	const getTypeOfSymbol = (symbol, isValue) => {
 		let decl;
 		const type = (() => {
@@ -969,6 +987,18 @@ const printError = (diagnostic) => {
 		}
 
 		if (symbol) {
+			// Handle `NodeJS` prefix for global types
+			if (symbol.escapedName !== undefined) {
+				const fullEscapedName = getFullEscapedName(symbol);
+
+				if (fullEscapedName.includes("NodeJS.")) {
+					return {
+						type: "primitive",
+						name: fullEscapedName,
+					};
+				}
+			}
+
 			const decl = getDeclaration(symbol);
 			if (decl && isNodeModulesSource(decl.getSourceFile())) {
 				let symbol = /** @type {any} */ (decl).symbol;
diff --git a/package.json b/package.json
index 5c7c150..6d01f34 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
     "@types/node": "^14.14.14",
     "@types/yargs": "^15.0.12",
     "prettier": "^3.0.1",
-    "typescript": "^5.0.4"
+    "typescript": "^5.4.2"
   },
   "dependencies": {
     "@yarnpkg/lockfile": "^1.1.0",
diff --git a/yarn.lock b/yarn.lock
index cfef0ee..858e60c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -521,10 +521,10 @@ type@^2.0.0:
   resolved "https://registry.yarnpkg.com/type/-/type-2.1.0.tgz#9bdc22c648cf8cf86dd23d32336a41cfb6475e3f"
   integrity sha512-G9absDWvhAWCV2gmF1zKud3OyC61nZDwWvBL2DApaVFogI07CprggiQAOOjvp2NRjYWFzPyu7vwtDrQFq8jeSA==
 
-typescript@^5.0.4:
-  version "5.0.4"
-  resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
-  integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
+typescript@^5.4.2:
+  version "5.4.2"
+  resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.2.tgz#0ae9cebcfae970718474fe0da2c090cad6577372"
+  integrity sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==
 
 uri-js@^4.2.2:
   version "4.4.1"