3
3
baseName , dirName , isBaseDir , isURL , joinPaths , maybeAddRelativeLocalPrefix , normalizeSlashes , relativePath ,
4
4
removeSuffix
5
5
} from "../utils" ;
6
- import { getOutputExtension , Node , Pattern , removeFileExtension , ResolvedModuleFull , SourceFile } from "typescript" ;
7
- import { getOutputPathForSourceFile } from "../ts" ;
6
+ import { Node , Pattern , removeFileExtension , ResolvedModuleFull , SourceFile } from "typescript" ;
7
+ import { getOutputPathForSourceFile , getOutputExtension } from "../ts" ;
8
8
import { getOutputPathDetail , OutputPathDetail } from "./output-path-detail" ;
9
9
import { IndexFlags } from "./index-checker" ;
10
10
@@ -63,6 +63,8 @@ function getReturnPath(ctx: GetReturnPathContext) {
63
63
resolver,
64
64
config : { outputExtensions, outputIndexes } ,
65
65
compilerOptions,
66
+ tsInstance,
67
+ isDeclarationFile
66
68
} = ctx . visitorContext ;
67
69
const { suppliedExt, resolvedPath, isImplicitExtension, indexDetail, isExternalLibraryImport } = ctx . pathDetail ?? { } ;
68
70
@@ -74,7 +76,7 @@ function getReturnPath(ctx: GetReturnPathContext) {
74
76
! isImplicitExtension && outputExtensions !== 'never'
75
77
? suppliedExt
76
78
: outputExtensions === 'always'
77
- ? getOutputExtension ( resolvedSourceFile ! , compilerOptions )
79
+ ? getOutputExtension ( tsInstance , compilerOptions , resolvedSourceFile ! , isDeclarationFile )
78
80
: void 0 ;
79
81
80
82
let usesStrippedIndex = false ;
0 commit comments