take issue to throw on

This commit is contained in:
Sheetal Nandi
2025-10-01 11:21:03 -07:00
parent 90a83428f8
commit bee7f78b8a
4 changed files with 11 additions and 7 deletions

View File

@@ -1673,7 +1673,7 @@ function tryLoadModuleUsingBaseUrl(extensions: Extensions, moduleName: string, l
trace(state.host, Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, baseUrl, candidate);
}
const res = loader(extensions, candidate, !directoryProbablyExists(getDirectoryPath(candidate), state.host), state);
if (res) {
if (res && state.compilerOptions.issueType === "baseUrl") {
throw new Error("TS_FIX_BASEURL_SIGNAL");
}
return res;

View File

@@ -315,7 +315,6 @@ import {
trace,
tracing,
tryCast,
tsFixRootDirSignal,
TypeChecker,
typeDirectiveIsEqualTo,
TypeReferenceDirectiveResolutionCache,
@@ -2149,6 +2148,12 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
return ts_toPath(fileName, currentDirectory, getCanonicalFileName);
}
function tsFixRootDirSignal(kind: string, rootDir: string, rootDir60: string): void {
if (options.issueType === "rootDir") {
throw new Error(`TS_FIX_ROOTDIR_SIGNAL:: ${kind}:: 5.9:: ${rootDir} 6.0:: ${rootDir60} <End>`);
}
}
function getCommonSourceDirectory() {
let commonSourceDirectory = programDiagnostics.getCommonSourceDirectory();
if (commonSourceDirectory !== undefined) {

View File

@@ -7395,7 +7395,11 @@ export enum PollingWatchKind {
export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[] | ProjectReference[] | null | undefined; // eslint-disable-line no-restricted-syntax
/** @internal */
export type IssueType = "baseUrl" | "rootDir" | "types";
export interface CompilerOptions {
/** @internal */ issueType?: IssueType;
/** @internal */ all?: boolean;
allowImportingTsExtensions?: boolean;
allowJs?: boolean;

View File

@@ -6628,11 +6628,6 @@ export function sourceFileMayBeEmitted(sourceFile: SourceFile, host: SourceFileM
return true;
}
/**@internal */
export function tsFixRootDirSignal(kind: string, rootDir: string, rootDir60: string): void {
throw new Error(`TS_FIX_ROOTDIR_SIGNAL:: ${kind}:: 5.9:: ${rootDir} 6.0:: ${rootDir60} <End>`);
}
/** @internal */
export function sourceFileMayBeEmitted60(sourceFile: SourceFile, host: SourceFileMayBeEmittedHost, forceDtsEmit?: boolean): boolean {
const options = host.getCompilerOptions();