Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getTypeRoots(): string[] {
// If @types/node does not exist in the default type roots,
// use @types under tslab/node_modules (bug#10).
// TODO: Integration-test for this behavior.
const typeRoots =
ts.getDefaultTypeRoots(cwd, {
directoryExists: sys.directoryExists
}) || [];
for (const root of typeRoots) {
if (ts.sys.fileExists(pathlib.join(root, "node", "package.json"))) {
return typeRoots;
}
}
typeRoots.push(pathlib.join(__dirname, "..", "node_modules", "@types"));
return typeRoots;
}