mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Ensure that when new file affecting global scope is added, the signatures are updated (#43084)
* Ensure that when new file affecting global scope is added, the signatures are updated * Update src/compiler/builder.ts * Better comment
This commit is contained in:
1 parent
6e4456b3b4
commit
acc8f2fb05
3 files changed
+729
No files matched your search
@@ -236,6 +236,58 @@ const a: string = 10;`, "utf-8"),
|
||||
}
|
||||
});
|
||||
|
||||
verifyTscSerializedIncrementalEdits({
|
||||
scenario: "incremental",
|
||||
subScenario: `when global file is added, the signatures are updated`,
|
||||
fs: () => loadProjectFromFiles({
|
||||
"/src/project/src/main.ts": Utils.dedent`
|
||||
/// <reference path="./filePresent.ts"/>
|
||||
/// <reference path="./fileNotFound.ts"/>
|
||||
function main() { }
|
||||
`,
|
||||
"/src/project/src/anotherFileWithSameReferenes.ts": Utils.dedent`
|
||||
/// <reference path="./filePresent.ts"/>
|
||||
/// <reference path="./fileNotFound.ts"/>
|
||||
function anotherFileWithSameReferenes() { }
|
||||
`,
|
||||
"/src/project/src/filePresent.ts": `function something() { return 10; }`,
|
||||
"/src/project/tsconfig.json": JSON.stringify({
|
||||
compilerOptions: { composite: true, },
|
||||
include: ["src/**/*.ts"]
|
||||
}),
|
||||
}),
|
||||
commandLineArgs: ["--p", "src/project"],
|
||||
incrementalScenarios: [
|
||||
noChangeRun,
|
||||
{
|
||||
subScenario: "Modify main file",
|
||||
buildKind: BuildKind.IncrementalDtsChange,
|
||||
modifyFs: fs => appendText(fs, `/src/project/src/main.ts`, `something();`),
|
||||
},
|
||||
{
|
||||
subScenario: "Add new file and update main file",
|
||||
buildKind: BuildKind.IncrementalDtsChange,
|
||||
modifyFs: fs => {
|
||||
fs.writeFileSync(`/src/project/src/newFile.ts`, "function foo() { return 20; }");
|
||||
prependText(fs, `/src/project/src/main.ts`, `/// <reference path="./newFile.ts"/>
|
||||
`);
|
||||
appendText(fs, `/src/project/src/main.ts`, `foo();`);
|
||||
},
|
||||
},
|
||||
{
|
||||
subScenario: "Write file that could not be resolved",
|
||||
buildKind: BuildKind.IncrementalDtsChange,
|
||||
modifyFs: fs => fs.writeFileSync(`/src/project/src/fileNotFound.ts`, "function something2() { return 20; }"),
|
||||
},
|
||||
{
|
||||
subScenario: "Modify main file",
|
||||
buildKind: BuildKind.IncrementalDtsChange,
|
||||
modifyFs: fs => appendText(fs, `/src/project/src/main.ts`, `something();`),
|
||||
},
|
||||
],
|
||||
baselinePrograms: true,
|
||||
});
|
||||
|
||||
const jsxLibraryContent = `
|
||||
export {};
|
||||
declare global {
|
||||
|
||||
Reference in new issue
Block a user