Skip to content

Commit fe0d68b

Browse files
committed
Update TypeScriptInternals.getResolvedModule() for TypeScript 5.3
1 parent 1dc8d0e commit fe0d68b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ export class ExportAnalyzer {
268268
: undefined;
269269

270270
const resolvedModule: ts.ResolvedModuleFull | undefined = TypeScriptInternals.getResolvedModule(
271+
this._program,
271272
importOrExportDeclaration.getSourceFile(),
272273
moduleSpecifier,
273274
mode
@@ -882,6 +883,7 @@ export class ExportAnalyzer {
882883
)
883884
: undefined;
884885
const resolvedModule: ts.ResolvedModuleFull | undefined = TypeScriptInternals.getResolvedModule(
886+
this._program,
885887
importOrExportDeclaration.getSourceFile(),
886888
moduleSpecifier,
887889
mode

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,19 @@ export class TypeScriptInternals {
8282
* The compiler populates this cache as part of analyzing the source file.
8383
*/
8484
public static getResolvedModule(
85+
program: ts.Program,
8586
sourceFile: ts.SourceFile,
8687
moduleNameText: string,
8788
mode: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined
8889
): ts.ResolvedModuleFull | undefined {
8990
// Compiler internal:
90-
// https://github.com/microsoft/TypeScript/blob/v4.7.2/src/compiler/utilities.ts#L161
91-
92-
return (ts as any).getResolvedModule(sourceFile, moduleNameText, mode);
91+
// https://github.com/microsoft/TypeScript/blob/v5.3-beta/src/compiler/types.ts#L4678
92+
const result: ts.ResolvedModuleWithFailedLookupLocations | undefined = (program as any).getResolvedModule(
93+
sourceFile,
94+
moduleNameText,
95+
mode
96+
);
97+
return result?.resolvedModule;
9398
}
9499

95100
/**

0 commit comments

Comments
 (0)