Skip to content

Commit d03d107

Browse files
authored
Make compiler options which map to a flag case-insensitive again (#17755)
1 parent 360dc91 commit d03d107

5 files changed

+77
-2
lines changed

src/compiler/commandLineParser.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ namespace ts {
11161116
if (option && typeof option.type !== "string") {
11171117
const customOption = <CommandLineOptionOfCustomType>option;
11181118
// Validate custom option type
1119-
if (!customOption.type.has(text)) {
1119+
if (!customOption.type.has(text.toLowerCase())) {
11201120
errors.push(
11211121
createDiagnosticForInvalidCustomType(
11221122
customOption,
@@ -1811,7 +1811,7 @@ namespace ts {
18111811
return value;
18121812
}
18131813
else if (typeof option.type !== "string") {
1814-
return option.type.get(value);
1814+
return option.type.get(typeof value === "string" ? value.toLowerCase() : value);
18151815
}
18161816
return normalizeNonListOptionValue(option, basePath, value);
18171817
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//// [tests/cases/compiler/tsconfigMapOptionsAreCaseInsensitive.ts] ////
2+
3+
//// [other.ts]
4+
export default 42;
5+
6+
//// [index.ts]
7+
import Answer from "./other.js";
8+
const x = 10 + Answer;
9+
export {
10+
x
11+
};
12+
13+
//// [other.js]
14+
define(["require", "exports"], function (require, exports) {
15+
"use strict";
16+
exports.__esModule = true;
17+
exports["default"] = 42;
18+
});
19+
//// [index.js]
20+
define(["require", "exports", "./other.js"], function (require, exports, other_js_1) {
21+
"use strict";
22+
exports.__esModule = true;
23+
var x = 10 + other_js_1["default"];
24+
exports.x = x;
25+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/compiler/other.ts ===
2+
export default 42;
3+
No type information for this code.
4+
No type information for this code.=== tests/cases/compiler/index.ts ===
5+
import Answer from "./other.js";
6+
>Answer : Symbol(Answer, Decl(index.ts, 0, 6))
7+
8+
const x = 10 + Answer;
9+
>x : Symbol(x, Decl(index.ts, 1, 5))
10+
>Answer : Symbol(Answer, Decl(index.ts, 0, 6))
11+
12+
export {
13+
x
14+
>x : Symbol(x, Decl(index.ts, 2, 8))
15+
16+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
=== tests/cases/compiler/other.ts ===
2+
export default 42;
3+
No type information for this code.
4+
No type information for this code.=== tests/cases/compiler/index.ts ===
5+
import Answer from "./other.js";
6+
>Answer : 42
7+
8+
const x = 10 + Answer;
9+
>x : number
10+
>10 + Answer : number
11+
>10 : 10
12+
>Answer : 42
13+
14+
export {
15+
x
16+
>x : number
17+
18+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// @filename: tsconfig.json
2+
{
3+
"compilerOptions": {
4+
"module": "AmD"
5+
}
6+
}
7+
8+
// @filename: other.ts
9+
export default 42;
10+
11+
// @filename: index.ts
12+
import Answer from "./other.js";
13+
const x = 10 + Answer;
14+
export {
15+
x
16+
};

0 commit comments

Comments
 (0)