-
Notifications
You must be signed in to change notification settings - Fork 13k
Assume rootDir is the current configuration directory #62418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
859f6c1
25d86d2
717cfa8
3ca473b
1f2989e
00f8908
a0b3d17
cbb10d2
8636f8c
53a4c6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,7 @@ import { | |
GetCanonicalFileName, | ||
getCommonSourceDirectory as ts_getCommonSourceDirectory, | ||
getCommonSourceDirectoryOfConfig, | ||
getComputedCommonSourceDirectory, | ||
getDeclarationDiagnostics as ts_getDeclarationDiagnostics, | ||
getDefaultLibFileName, | ||
getDirectoryPath, | ||
|
@@ -4293,6 +4294,27 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro | |
} | ||
} | ||
|
||
if ( | ||
!options.noEmit && | ||
!options.composite && | ||
!options.rootDir && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you don't want to do this check if |
||
options.configFilePath && | ||
(options.outDir || // there is --outDir specified | ||
(getEmitDeclarations(options) && options.declarationDir)) // there is --declarationDir specified | ||
) { | ||
// Check if rootDir inferred changed and issue diagnostic | ||
const dir = getCommonSourceDirectory(); | ||
const emittedFiles = mapDefined(files, file => !file.isDeclarationFile && sourceFileMayBeEmitted(file, program) ? file.fileName : undefined); | ||
const dir59 = getComputedCommonSourceDirectory(emittedFiles, currentDirectory, getCanonicalFileName); | ||
if (dir59 !== "" && getCanonicalFileName(dir) !== getCanonicalFileName(dir59)) { | ||
// change in layout | ||
programDiagnostics.addConfigDiagnostic(createCompilerDiagnosticFromMessageChain(chainDiagnosticMessages( | ||
chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information), | ||
Diagnostics.Inferred_common_source_directory_differs_from_tsconfig_directory_output_layout_will_be_changed, | ||
))); | ||
} | ||
} | ||
|
||
if (options.checkJs && !getAllowJSCompilerOption(options)) { | ||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs"); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
error TS5011: Inferred common source directory differs from tsconfig directory, output layout will be changed. | ||
Visit https://aka.ms/ts6 for migration information. | ||
|
||
|
||
!!! error TS5011: Inferred common source directory differs from tsconfig directory, output layout will be changed. | ||
!!! error TS5011: Visit https://aka.ms/ts6 for migration information. | ||
==== /app/tsconfig.json (0 errors) ==== | ||
{ | ||
"compilerOptions": { | ||
"outDir": "bin", | ||
"sourceMap": true, | ||
"mapRoot": "myMapRoot", | ||
"sourceRoot": "mySourceRoot", | ||
"declaration": true | ||
} | ||
} | ||
|
||
==== /app/lib/bar.d.ts (0 errors) ==== | ||
declare const y: number; | ||
|
||
==== /app/src/index.ts (0 errors) ==== | ||
/// <reference path="../lib/bar.d.ts" preserve="true" /> | ||
export const x = y; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.