@@ -290,12 +290,13 @@ namespace ts {
290
290
291
291
const typeRoots : string [ ] = [ ] ;
292
292
for ( const [ name , referencish ] of Array . from < any > ( packageDependencies . entries ( ) ) ) {
293
- if ( name . startsWith ( typesPackagePrefix ) && referencish !== null ) {
294
- const dependencyLocator = pnpapi . getLocator ( name , referencish ) ;
295
- const { packageLocation} = pnpapi . getPackageInformation ( dependencyLocator ) ;
293
+ // eslint-disable-next-line no-null/no-null
294
+ if ( name . startsWith ( typesPackagePrefix ) && referencish !== null ) {
295
+ const dependencyLocator = pnpapi . getLocator ( name , referencish ) ;
296
+ const { packageLocation} = pnpapi . getPackageInformation ( dependencyLocator ) ;
296
297
297
- typeRoots . push ( getDirectoryPath ( packageLocation ) ) ;
298
- }
298
+ typeRoots . push ( getDirectoryPath ( packageLocation ) ) ;
299
+ }
299
300
}
300
301
301
302
return typeRoots ;
@@ -1575,7 +1576,7 @@ namespace ts {
1575
1576
* that the runtime has already been executed).
1576
1577
* @internal
1577
1578
*/
1578
- export function isPnpAvailable ( ) {
1579
+ function isPnpAvailable ( ) {
1579
1580
// @ts -ignore
1580
1581
return process . versions . pnp ;
1581
1582
}
@@ -1587,15 +1588,18 @@ namespace ts {
1587
1588
function loadPnpPackageResolution ( packageName : string , containingDirectory : string ) {
1588
1589
try {
1589
1590
return getPnpApi ( ) . resolveToUnqualified ( packageName , `${ containingDirectory } /` , { considerBuiltins : false } ) ;
1590
- } catch { }
1591
+ }
1592
+ catch {
1593
+ // Nothing to do
1594
+ }
1591
1595
}
1592
1596
1593
1597
function loadPnpTypePackageResolution ( packageName : string , containingDirectory : string ) {
1594
1598
return loadPnpPackageResolution ( getTypesPackageName ( packageName ) , containingDirectory ) ;
1595
1599
}
1596
1600
1597
1601
/* @internal */
1598
- export function tryLoadModuleUsingPnpResolution ( extensions : Extensions , moduleName : string , containingDirectory : string , state : ModuleResolutionState ) {
1602
+ function tryLoadModuleUsingPnpResolution ( extensions : Extensions , moduleName : string , containingDirectory : string , state : ModuleResolutionState ) {
1599
1603
const { packageName, rest} = parsePackageName ( moduleName ) ;
1600
1604
1601
1605
const packageResolution = loadPnpPackageResolution ( packageName , containingDirectory ) ;
@@ -1606,7 +1610,8 @@ namespace ts {
1606
1610
let resolved ;
1607
1611
if ( packageFullResolution ) {
1608
1612
resolved = packageFullResolution ;
1609
- } else if ( extensions === Extensions . TypeScript || extensions === Extensions . DtsOnly ) {
1613
+ }
1614
+ else if ( extensions === Extensions . TypeScript || extensions === Extensions . DtsOnly ) {
1610
1615
const typePackageResolution = loadPnpTypePackageResolution ( packageName , containingDirectory ) ;
1611
1616
const typePackageFullResolution = typePackageResolution
1612
1617
? nodeLoadModuleByRelativeName ( Extensions . DtsOnly , combinePaths ( typePackageResolution , rest ) , /*onlyRecordFailures*/ false , state , /*considerPackageJson*/ true )
0 commit comments