File tree 3 files changed +20
-4
lines changed
3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,11 @@ export class ExportAnalyzer {
265
265
: importOrExportDeclaration . moduleSpecifier ;
266
266
const mode : ts . ModuleKind . CommonJS | ts . ModuleKind . ESNext | undefined =
267
267
specifier && ts . isStringLiteralLike ( specifier )
268
- ? TypeScriptInternals . getModeForUsageLocation ( importOrExportDeclaration . getSourceFile ( ) , specifier )
268
+ ? TypeScriptInternals . getModeForUsageLocation (
269
+ importOrExportDeclaration . getSourceFile ( ) ,
270
+ specifier ,
271
+ this . _program . getCompilerOptions ( )
272
+ )
269
273
: undefined ;
270
274
271
275
const resolvedModule : ts . ResolvedModuleFull | undefined = TypeScriptInternals . getResolvedModule (
@@ -905,7 +909,8 @@ export class ExportAnalyzer {
905
909
ts . isStringLiteralLike ( importOrExportDeclaration . moduleSpecifier )
906
910
? TypeScriptInternals . getModeForUsageLocation (
907
911
importOrExportDeclaration . getSourceFile ( ) ,
908
- importOrExportDeclaration . moduleSpecifier
912
+ importOrExportDeclaration . moduleSpecifier ,
913
+ this . _program . getCompilerOptions ( )
909
914
)
910
915
: undefined ;
911
916
const resolvedModule : ts . ResolvedModuleFull | undefined = TypeScriptInternals . getResolvedModule (
Original file line number Diff line number Diff line change @@ -102,12 +102,13 @@ export class TypeScriptInternals {
102
102
*/
103
103
public static getModeForUsageLocation (
104
104
file : { impliedNodeFormat ?: ts . SourceFile [ 'impliedNodeFormat' ] } ,
105
- usage : ts . StringLiteralLike | undefined
105
+ usage : ts . StringLiteralLike ,
106
+ compilerOptions : ts . CompilerOptions
106
107
) : ts . ModuleKind . CommonJS | ts . ModuleKind . ESNext | undefined {
107
108
// Compiler internal:
108
109
// https://github.com/microsoft/TypeScript/blob/v4.7.2/src/compiler/program.ts#L568
109
110
110
- return ( ts as any ) . getModeForUsageLocation ?.( file , usage ) ;
111
+ return ts . getModeForUsageLocation ?.( file , usage , compilerOptions ) ;
111
112
}
112
113
113
114
/**
Original file line number Diff line number Diff line change
1
+ {
2
+ "changes" : [
3
+ {
4
+ "packageName" : " @microsoft/api-extractor" ,
5
+ "comment" : " Fix a compatibility issue with usage of `getModeForUsageLocation` in TypeScript 5.6" ,
6
+ "type" : " patch"
7
+ }
8
+ ],
9
+ "packageName" : " @microsoft/api-extractor"
10
+ }
You can’t perform that action at this time.
0 commit comments