mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
resolveJsonModule affectsModuleResolution (#36290)
* resolveJsonModule affectsModuleResolutionFixes: #36251 * fix lint
This commit is contained in:
committed by
Sheetal Nandi
parent
bc1e7728df
commit
1fbe20fe75
@@ -766,6 +766,7 @@ namespace ts {
|
||||
{
|
||||
name: "resolveJsonModule",
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Include_modules_imported_with_json_extension
|
||||
},
|
||||
|
||||
@@ -1228,6 +1228,34 @@ export function f(p: C) { return p; }`
|
||||
]
|
||||
});
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "updates moduleResolution when resolveJsonModule changes",
|
||||
commandLineArgs: ["-w"],
|
||||
sys: () => {
|
||||
const aFile: File = {
|
||||
path: `${projectRoot}/a.ts`,
|
||||
content: `import * as data from './data.json'`
|
||||
};
|
||||
const jsonFile: File = {
|
||||
path: `${projectRoot}/data.json`,
|
||||
content: `{ "foo": 1 }`
|
||||
};
|
||||
const config: File = {
|
||||
path: `${projectRoot}/tsconfig.json`,
|
||||
content: JSON.stringify({ compilerOptions: { moduleResolution: "node" } })
|
||||
};
|
||||
return createWatchedSystem([aFile, jsonFile, config, libFile], { currentDirectory: projectRoot });
|
||||
},
|
||||
changes: [
|
||||
sys => {
|
||||
sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: { moduleResolution: "node", resolveJsonModule: true } }));
|
||||
sys.runQueuedTimeoutCallbacks();
|
||||
return "Enable resolveJsonModule";
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "updates errors when ambient modules of program changes",
|
||||
|
||||
Reference in New Issue
Block a user