Skip to content

Commit 97a7a81

Browse files
committed
Amended some comments
1 parent 6140e41 commit 97a7a81

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

apps/api-extractor/src/analyzer/ExportAnalyzer.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,10 @@ export class ExportAnalyzer {
264264
moduleSpecifier
265265
);
266266

267-
// This is known to happen for ambient modules. For now, just treat all ambient modules as
268-
// external. This is tracked by https://github.com/microsoft/rushstack/issues/3335.
269267
if (resolvedModule === undefined) {
268+
// The TS compiler API `getResolvedModule` cannot resolve ambient modules. Thus, to match API Extractor's
269+
// previous behavior, simply treat all ambient modules as external. This bug is tracked by
270+
// https://github.com/microsoft/rushstack/issues/3335.
270271
return true;
271272
}
272273

@@ -868,10 +869,11 @@ export class ExportAnalyzer {
868869
);
869870

870871
if (resolvedModule === undefined) {
871-
// This should not happen, since getResolvedModule() specifically looks up names that the compiler
872-
// found in export declarations for this source file
872+
// Encountered in https://github.com/microsoft/rushstack/issues/1914.
873873
//
874-
// Encountered in https://github.com/microsoft/rushstack/issues/1914
874+
// It's also possible for this to occur with ambient modules. However, in practice this doesn't happen
875+
// as API Extractor treats all ambient modules as external per the logic in `_isExternalModulePath`, and
876+
// thus this code path is never reached for ambient modules.
875877
throw new InternalError(
876878
`getResolvedModule() could not resolve module name ${JSON.stringify(moduleSpecifier)}\n` +
877879
SourceFileLocationFormatter.formatDeclaration(importOrExportDeclaration)

0 commit comments

Comments
 (0)