mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-25 22:01:51 -05:00
forceConsistentCasingInFileNames affects module resolution (#36334)
This commit is contained in:
committed by
Sheetal Nandi
parent
8976ac96aa
commit
342f4c0b54
@@ -951,6 +951,7 @@ namespace ts {
|
||||
{
|
||||
name: "forceConsistentCasingInFileNames",
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file
|
||||
},
|
||||
|
||||
@@ -1228,6 +1228,35 @@ export function f(p: C) { return p; }`
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "updates errors when forceConsistentCasingInFileNames changes",
|
||||
commandLineArgs: ["-w"],
|
||||
sys: () => {
|
||||
const aFile: File = {
|
||||
path: `/a.ts`,
|
||||
content: `export class C {}`
|
||||
};
|
||||
const bFile: File = {
|
||||
path: `/b.ts`,
|
||||
content: `import {C} from './a'; import * as A from './A';`
|
||||
};
|
||||
const config: File = {
|
||||
path: `/tsconfig.json`,
|
||||
content: JSON.stringify({ compilerOptions: {} })
|
||||
};
|
||||
return createWatchedSystem([aFile, bFile, config, libFile], { useCaseSensitiveFileNames: false });
|
||||
},
|
||||
changes: [
|
||||
sys => {
|
||||
sys.writeFile(`/tsconfig.json`, JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } }));
|
||||
sys.runQueuedTimeoutCallbacks();
|
||||
return "Enable forceConsistentCasingInFileNames";
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "updates moduleResolution when resolveJsonModule changes",
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
/a/lib/tsc.js -w
|
||||
//// [/a.ts]
|
||||
export class C {}
|
||||
|
||||
//// [/b.ts]
|
||||
import {C} from './a'; import * as A from './A';
|
||||
|
||||
//// [/tsconfig.json]
|
||||
{"compilerOptions":{}}
|
||||
|
||||
//// [/a/lib/lib.d.ts]
|
||||
/// <reference no-default-lib="true"/>
|
||||
interface Boolean {}
|
||||
interface Function {}
|
||||
interface CallableFunction {}
|
||||
interface NewableFunction {}
|
||||
interface IArguments {}
|
||||
interface Number { toExponential: any; }
|
||||
interface Object {}
|
||||
interface RegExp {}
|
||||
interface String { charAt: any; }
|
||||
interface Array<T> { length: number; [n: number]: T; }
|
||||
|
||||
//// [/a.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
exports.C = C;
|
||||
|
||||
|
||||
//// [/b.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
|
||||
|
||||
|
||||
Output::
|
||||
>> Screen clear
|
||||
12:00:15 AM - Starting compilation in watch mode...
|
||||
|
||||
|
||||
|
||||
12:00:20 AM - Found 0 errors. Watching for file changes.
|
||||
|
||||
|
||||
Program root files: ["/a.ts","/b.ts","/a/lib/lib.d.ts"]
|
||||
Program options: {"watch":true,"configFilePath":"/tsconfig.json"}
|
||||
Program files::
|
||||
/a.ts
|
||||
/b.ts
|
||||
/a/lib/lib.d.ts
|
||||
|
||||
Semantic diagnostics in builder refreshed for::
|
||||
/a.ts
|
||||
/b.ts
|
||||
/a/lib/lib.d.ts
|
||||
|
||||
WatchedFiles::
|
||||
/tsconfig.json:
|
||||
{"pollingInterval":250}
|
||||
/a.ts:
|
||||
{"pollingInterval":250}
|
||||
/b.ts:
|
||||
{"pollingInterval":250}
|
||||
/a/lib/lib.d.ts:
|
||||
{"pollingInterval":250}
|
||||
|
||||
FsWatches::
|
||||
|
||||
FsWatchesRecursive::
|
||||
/:
|
||||
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
|
||||
|
||||
exitCode:: ExitStatus.undefined
|
||||
|
||||
Change:: Enable forceConsistentCasingInFileNames
|
||||
|
||||
//// [/tsconfig.json]
|
||||
{"compilerOptions":{"forceConsistentCasingInFileNames":true}}
|
||||
|
||||
|
||||
Output::
|
||||
>> Screen clear
|
||||
12:00:24 AM - File change detected. Starting incremental compilation...
|
||||
|
||||
|
||||
b.ts(1,43): error TS1149: File name '/A.ts' differs from already included file name '/a.ts' only in casing.
|
||||
|
||||
|
||||
12:00:25 AM - Found 1 error. Watching for file changes.
|
||||
|
||||
|
||||
Program root files: ["/a.ts","/b.ts","/a/lib/lib.d.ts"]
|
||||
Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"configFilePath":"/tsconfig.json"}
|
||||
Program files::
|
||||
/a.ts
|
||||
/b.ts
|
||||
/a/lib/lib.d.ts
|
||||
|
||||
Semantic diagnostics in builder refreshed for::
|
||||
|
||||
WatchedFiles::
|
||||
/tsconfig.json:
|
||||
{"pollingInterval":250}
|
||||
/a.ts:
|
||||
{"pollingInterval":250}
|
||||
/b.ts:
|
||||
{"pollingInterval":250}
|
||||
/a/lib/lib.d.ts:
|
||||
{"pollingInterval":250}
|
||||
|
||||
FsWatches::
|
||||
|
||||
FsWatchesRecursive::
|
||||
/:
|
||||
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
|
||||
|
||||
exitCode:: ExitStatus.undefined
|
||||
Reference in New Issue
Block a user