Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add nullchecks for typeRoots, remove getCurrentDirectory from ServerH…
…ost as it is always the installation location
  • Loading branch information
zhengbli committed Jun 28, 2016
commit d5cad239e858ca71e89aa8963a7d875928652a65
10 changes: 6 additions & 4 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ namespace ts {
const failedLookupLocations: string[] = [];

// Check primary library paths
if (typeRoots.length) {
if (typeRoots && typeRoots.length) {
if (traceEnabled) {
trace(host, Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
}
Expand Down Expand Up @@ -1060,9 +1060,11 @@ namespace ts {
let result: string[] = [];
if (host.directoryExists && host.getDirectories) {
const typeRoots = getEffectiveTypeRoots(options, host);
for (const root of typeRoots) {
if (host.directoryExists(root)) {
result = result.concat(host.getDirectories(root));
if (typeRoots) {
for (const root of typeRoots) {
if (host.directoryExists(root)) {
result = result.concat(host.getDirectories(root));
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/server/editorServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ namespace ts.server {
this.moduleResolutionHost = {
fileExists: fileName => this.fileExists(fileName),
readFile: fileName => this.host.readFile(fileName),
getCurrentDirectory: () => this.host.getCurrentDirectory(),
directoryExists: directoryName => this.host.directoryExists(directoryName)
};
}
Expand Down