mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-16 15:51:35 -05:00
Cherry-pick PR #32878 into release-3.6
Component commits:c78c88f447Fix references to path-mapped ambient modules in declaration files48a1fc33f5Fix lint
This commit is contained in:
committed by
typescript-bot
parent
635a158d4f
commit
ef222a5892
@@ -748,6 +748,7 @@ namespace ts {
|
||||
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
||||
getProgramBuildInfo: returnUndefined,
|
||||
getSourceFileFromReference: returnUndefined,
|
||||
redirectTargetsMap: createMultiMap()
|
||||
};
|
||||
emitFiles(
|
||||
notImplementedResolver,
|
||||
|
||||
@@ -1446,6 +1446,7 @@ namespace ts {
|
||||
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
||||
getProgramBuildInfo: () => program.getProgramBuildInfo && program.getProgramBuildInfo(),
|
||||
getSourceFileFromReference: (file, ref) => program.getSourceFileFromReference(file, ref),
|
||||
redirectTargetsMap,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -327,6 +327,26 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (declFileName) {
|
||||
const specifier = moduleSpecifiers.getModuleSpecifier(
|
||||
// We pathify the baseUrl since we pathify the other paths here, so we can still easily check if the other paths are within the baseUrl
|
||||
// TODO: Should we _always_ be pathifying the baseUrl as we read it in?
|
||||
{ ...options, baseUrl: options.baseUrl && toPath(options.baseUrl, host.getCurrentDirectory(), host.getCanonicalFileName) },
|
||||
currentSourceFile,
|
||||
toPath(outputFilePath, host.getCurrentDirectory(), host.getCanonicalFileName),
|
||||
toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName),
|
||||
host,
|
||||
host.getSourceFiles(),
|
||||
/*preferences*/ undefined,
|
||||
host.redirectTargetsMap
|
||||
);
|
||||
if (!pathIsRelative(specifier)) {
|
||||
// If some compiler option/symlink/whatever allows access to the file containing the ambient module declaration
|
||||
// via a non-relative name, emit a type reference directive to that non-relative name, rather than
|
||||
// a relative path to the declaration file
|
||||
recordTypeReferenceDirectivesIfNecessary([specifier]);
|
||||
return;
|
||||
}
|
||||
|
||||
let fileName = getRelativePathToDirectoryOrUrl(
|
||||
outputFilePath,
|
||||
declFileName,
|
||||
|
||||
@@ -5444,6 +5444,7 @@ namespace ts {
|
||||
writeFile: WriteFileCallback;
|
||||
getProgramBuildInfo(): ProgramBuildInfo | undefined;
|
||||
getSourceFileFromReference: Program["getSourceFileFromReference"];
|
||||
readonly redirectTargetsMap: RedirectTargetsMap;
|
||||
}
|
||||
|
||||
export interface TransformationContext {
|
||||
|
||||
Reference in New Issue
Block a user