Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/compiler/builderState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ namespace ts {
referencedMap,
exportedModulesMap,
hasCalledUpdateShapeSignature,
useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
useFileVersionAsSignature: (!disableUseFileVersionAsSignature && !useOldState) ||
!!newProgram.getCompilerOptions().assumeChangesAffectShape,
};
}

Expand Down
6 changes: 6 additions & 0 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ namespace ts {
category: Diagnostics.Advanced_Options,
description: Diagnostics.Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it
},
{
name: "assumeChangesAffectShape",
type: "boolean",
category: Diagnostics.Advanced_Options,
description: Diagnostics.Have_recompiles_in_incremental_and_watch_assume_that_any_change_to_file_can_affect_its_shape_resulting_in_affecting_it_s_dependecies
},
{
name: "locale",
type: "string",
Expand Down
4 changes: 4 additions & 0 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5061,6 +5061,10 @@
"category": "Message",
"code": 6388
},
"Have recompiles in '--incremental' and '--watch' assume that any change to file can affect its shape resulting in affecting it's dependecies.": {
"category": "Message",
"code": 6389
},

"The expected type comes from property '{0}' which is declared here on type '{1}'": {
"category": "Message",
Expand Down
1 change: 1 addition & 0 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5965,6 +5965,7 @@ namespace ts {
noImplicitUseStrict?: boolean;
noPropertyAccessFromIndexSignature?: boolean;
assumeChangesOnlyAffectDirectDependencies?: boolean;
assumeChangesAffectShape?: boolean;
noLib?: boolean;
noResolve?: boolean;
noUncheckedIndexedAccess?: boolean;
Expand Down
31 changes: 31 additions & 0 deletions src/testRunner/unittests/tsc/incremental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,37 @@ const a: string = 10;`, "utf-8"),
baselinePrograms: true,
});

verifyTscSerializedIncrementalEdits({
scenario: "incremental",
subScenario: "assumeChangesAffectShape",
fs: () => loadProjectFromFiles({
"/src/project/main.ts": `import { foo } from "./module";foo();`,
"/src/project/module.ts": `export function foo(): string { return "hello"; }`,
"/src/project/extraFile.ts": "export const extra = 10;",
"/src/project/tsconfig.json": JSON.stringify({
compilerOptions: { assumeChangesAffectShape: true }
})
}),
commandLineArgs: ["--incremental", "--p", "src/project"],
incrementalScenarios: [
{
subScenario: "Local edit to module",
modifyFs: fs => replaceText(fs, "/src/project/module.ts", "hello", "hello world"),
buildKind: BuildKind.IncrementalDtsUnchanged
},
{
subScenario: "Local edit to module again",
modifyFs: fs => replaceText(fs, "/src/project/module.ts", "hello", "hello world"),
buildKind: BuildKind.IncrementalDtsUnchanged
},
{
subScenario: "Api change edit to module",
modifyFs: fs => prependText(fs, "/src/project/module.ts", "export const x = 10;"),
buildKind: BuildKind.IncrementalDtsUnchanged
},
]
});

describe("when synthesized imports are added to files", () => {
function getJsxLibraryContent() {
return `
Expand Down
1 change: 1 addition & 0 deletions tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2861,6 +2861,7 @@ declare namespace ts {
noImplicitUseStrict?: boolean;
noPropertyAccessFromIndexSignature?: boolean;
assumeChangesOnlyAffectDirectDependencies?: boolean;
assumeChangesAffectShape?: boolean;
noLib?: boolean;
noResolve?: boolean;
noUncheckedIndexedAccess?: boolean;
Expand Down
1 change: 1 addition & 0 deletions tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2861,6 +2861,7 @@ declare namespace ts {
noImplicitUseStrict?: boolean;
noPropertyAccessFromIndexSignature?: boolean;
assumeChangesOnlyAffectDirectDependencies?: boolean;
assumeChangesAffectShape?: boolean;
noLib?: boolean;
noResolve?: boolean;
noUncheckedIndexedAccess?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"assumeChangesAffectShape": true
}
}
Loading