MCPcopy Index your code
hub / github.com/nodejs/node / getDefaultTypeRoots

Function getDefaultTypeRoots

test/fixtures/snapshot/typescript.js:42511–42525  ·  view source on GitHub ↗

* Returns the path to every node_modules/@types directory from some ancestor directory. * Returns undefined if there are none.

(currentDirectory, host)

Source from the content-addressed store, hash-verified

42509 * Returns undefined if there are none.
42510 */
42511 function getDefaultTypeRoots(currentDirectory, host) {
42512 if (!host.directoryExists) {
42513 return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
42514 // And if it doesn't exist, tough.
42515 }
42516 var typeRoots;
42517 ts.forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) {
42518 var atTypes = ts.combinePaths(directory, nodeModulesAtTypes);
42519 if (host.directoryExists(atTypes)) {
42520 (typeRoots || (typeRoots = [])).push(atTypes);
42521 }
42522 return undefined;
42523 });
42524 return typeRoots;
42525 }
42526 var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
42527 function arePathsEqual(path1, path2, host) {
42528 var useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;

Callers 1

getEffectiveTypeRootsFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected