mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
importsNotUsedAsValue affects semantic diagnostics (#36001)
* importsNotUsedAsValue affects semantic diagnostics * add tests
This commit is contained in:
committed by
Sheetal Nandi
parent
81a942e7b9
commit
f220e62ce7
@@ -480,6 +480,7 @@ namespace ts {
|
||||
error: importsNotUsedAsValues.Error
|
||||
}),
|
||||
affectsEmit: true,
|
||||
affectsSemanticDiagnostics: true,
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types
|
||||
},
|
||||
|
||||
@@ -1121,6 +1121,45 @@ foo().hello`
|
||||
]
|
||||
});
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "updates errors and emit when importsNotUsedAsValues changes",
|
||||
commandLineArgs: ["-w"],
|
||||
sys: () => {
|
||||
const aFile: File = {
|
||||
path: `${projectRoot}/a.ts`,
|
||||
content: `export class C {}`
|
||||
};
|
||||
const bFile: File = {
|
||||
path: `${projectRoot}/b.ts`,
|
||||
content: `import {C} from './a';
|
||||
export function f(p: C) { return p; }`
|
||||
};
|
||||
const config: File = {
|
||||
path: `${projectRoot}/tsconfig.json`,
|
||||
content: JSON.stringify({ compilerOptions: {} })
|
||||
};
|
||||
return createWatchedSystem([aFile, bFile, config, libFile], { currentDirectory: projectRoot });
|
||||
},
|
||||
changes: [
|
||||
sys => {
|
||||
sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: { importsNotUsedAsValues: "remove" } }));
|
||||
sys.runQueuedTimeoutCallbacks();
|
||||
return 'Set to "remove"';
|
||||
},
|
||||
sys => {
|
||||
sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: { importsNotUsedAsValues: "error" } }));
|
||||
sys.runQueuedTimeoutCallbacks();
|
||||
return 'Set to "error"';
|
||||
},
|
||||
sys => {
|
||||
sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: { importsNotUsedAsValues: "preserve" } }));
|
||||
sys.runQueuedTimeoutCallbacks();
|
||||
return 'Set to "preserve"';
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "updates errors when ambient modules of program changes",
|
||||
|
||||
Reference in New Issue
Block a user