Skip to content

Commit

Permalink
Tolerates running TS from a non-owning directory
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis committed Apr 22, 2020
1 parent c670e7f commit b8fbada
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/compiler/moduleNameResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ namespace ts {
const pnpapi = getPnpApi();

const currentPackage = pnpapi.findPackageLocator(`${currentDirectory}/`);
Debug.assert(!!currentPackage);
if (!currentPackage) {
return [];
}

const {packageDependencies} = pnpapi.getPackageInformation(currentPackage!);

Expand Down Expand Up @@ -1645,8 +1647,9 @@ namespace ts {

function checkPnpExternalLibraryImport(resolvedValue: Resolved) {
const pnpApi = getPnpApi();

const ownerPackage = pnpApi.findPackageLocator(resolvedValue.path);

// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
Debug.assert(!!ownerPackage);

const rootLocators = pnpApi.getDependencyTreeRoots();
Expand Down

0 comments on commit b8fbada

Please sign in to comment.