Skip to content

Commit 4a55025

Browse files
committed
Code review feedback
1 parent ae7e00e commit 4a55025

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/compiler/builder.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,13 @@ namespace ts {
406406
}
407407

408408
/**
409-
* Handles sematic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
409+
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
410410
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
411-
* Similar to cleanSemanticDiagnosticsOfAffectedFile
412411
*/
413412
function handleDtsMayChangeOfAffectedFile(state: BuilderProgramState, affectedFile: SourceFile, cancellationToken: CancellationToken | undefined, computeHash: BuilderState.ComputeHash) {
414413
removeSemanticDiagnosticsOf(state, affectedFile.path);
415414

416-
// If affected files is everything except default librarry, then nothing more to do
415+
// If affected files is everything except default library, then nothing more to do
417416
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
418417
if (!state.cleanedDiagnosticsOfLibFiles) {
419418
state.cleanedDiagnosticsOfLibFiles = true;
@@ -442,7 +441,19 @@ namespace ts {
442441
const program = Debug.assertDefined(state.program);
443442
const sourceFile = program.getSourceFileByPath(path);
444443
if (sourceFile) {
445-
BuilderState.updateShapeSignature(state, program, sourceFile, Debug.assertDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
444+
// Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics
445+
// we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file
446+
// This ensures that we dont later during incremental builds considering wrong signature.
447+
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
448+
BuilderState.updateShapeSignature(
449+
state,
450+
program,
451+
sourceFile,
452+
Debug.assertDefined(state.currentAffectedFilesSignatures),
453+
cancellationToken,
454+
computeHash,
455+
state.currentAffectedFilesExportedModulesMap
456+
);
446457
// If not dts emit, nothing more to do
447458
if (getEmitDeclarations(state.compilerOptions)) {
448459
addToAffectedFilesPendingEmit(state, [path]);

src/testRunner/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"unittests/tsbuild/amdModulesWithOut.ts",
9393
"unittests/tsbuild/emptyFiles.ts",
9494
"unittests/tsbuild/graphOrdering.ts",
95-
"unittests/tsbuild//inferredTypeFromTransitiveModule.ts",
95+
"unittests/tsbuild/inferredTypeFromTransitiveModule.ts",
9696
"unittests/tsbuild/missingExtendedFile.ts",
9797
"unittests/tsbuild/outFile.ts",
9898
"unittests/tsbuild/referencesWithRootDirInParent.ts",

0 commit comments

Comments
 (0)