-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
If you're using Typescript v3.5.2 and are attempting to automatically generate type guards and getting this error:
(node:24782) UnhandledPromiseRejectionWarning: TypeError: realpath is not a function
at visitDirectory (/home/simplyalec/WebstormProjects/SSManagerV3/node_modules/typescript/lib/typescript.js:16032:45)
at Object.matchFiles (/home/simplyalec/WebstormProjects/SSManagerV3/node_modules/typescript/lib/typescript.js:16028:13)
at Object.matchFiles (/home/simplyalec/WebstormProjects/SSManagerV3/node_modules/ts-simple-ast/dist/typescript/tsInternal.js:7:35)
at Object.readDirectory (/home/simplyalec/WebstormProjects/SSManagerV3/node_modules/ts-simple-ast/dist/utils/compiler/readDirectory.js:16:27)
at Object.readDirectory (/home/simplyalec/WebstormProjects/SSManagerV3/node_modules/ts-simple-ast/dist/utils/tsconfig/getTsParseConfigHost.js:11:37)
at getFileNamesFromConfigSpecs (/home/simplyalec/WebstormProjects/SSManagerV3/node_modules/typescript/lib/typescript.js:26140:40)
at matchFileNames (/home/simplyalec/WebstormProjects/SSManagerV3/node_modules/typescript/lib/typescript.js:26060:16)
at getFileNames (/home/simplyalec/WebstormProjects/SSManagerV3/node_modules/typescript/lib/typescript.js:25628:26)
at parseJsonConfigFileContentWorker (/home/simplyalec/WebstormProjects/SSManagerV3/node_modules/typescript/lib/typescript.js:25561:18)
at Object.parseJsonConfigFileContent (/home/simplyalec/WebstormProjects/SSManagerV3/node_modules/typescript/lib/typescript.js:25510:16)
(node:24782) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:24782) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
s
apply this patch file to your ./node_modules/typescript/lib/typescript.ts file:
@@ -16029,7 +16029,7 @@ var ts;
}
return ts.flatten(results);
function visitDirectory(path, absolutePath, depth) {
- var canonicalPath = toCanonical(realpath(absolutePath));
+ var canonicalPath = toCanonical(absolutePath);
if (visited.has(canonicalPath))
return;
visited.set(canonicalPath, true);
Metadata
Metadata
Assignees
Labels
No labels