Skip to content

Commit 31dda3b

Browse files
authored
Add noResolvePaths to tsconfig accepted options (#1154)
1 parent 4b7c1d4 commit 31dda3b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/cli/parse.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface CommandLineOptionOfEnum extends CommandLineOptionBase {
1818
}
1919

2020
interface CommandLineOptionOfPrimitive extends CommandLineOptionBase {
21-
type: "boolean" | "string" | "object";
21+
type: "boolean" | "string" | "object" | "array";
2222
}
2323

2424
type CommandLineOption = CommandLineOptionOfEnum | CommandLineOptionOfPrimitive;
@@ -78,6 +78,11 @@ export const optionDeclarations: CommandLineOption[] = [
7878
description: "Provide verbose output useful for diagnosing problems.",
7979
type: "boolean",
8080
},
81+
{
82+
name: "noResolvePaths",
83+
description: "An array of paths that tstl should not resolve and keep as-is.",
84+
type: "array",
85+
},
8186
];
8287

8388
export function updateParsedConfigFile(parsedConfigFile: ts.ParsedCommandLine): ParsedCommandLine {
@@ -199,7 +204,16 @@ function readValue(option: CommandLineOption, value: unknown): ReadValueResult {
199204

200205
return { value };
201206
}
207+
case "array": {
208+
if (!Array.isArray(value)) {
209+
return {
210+
value: undefined,
211+
error: cliDiagnostics.compilerOptionRequiresAValueOfType(option.name, option.type),
212+
};
213+
}
202214

215+
return { value };
216+
}
203217
case "enum": {
204218
if (typeof value !== "string") {
205219
return {

test/cli/parse.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,13 @@ describe("tsconfig", () => {
235235

236236
["luaBundle", "foo", { luaBundle: "foo" }],
237237
["luaBundleEntry", "bar", { luaBundleEntry: "bar" }],
238+
239+
["noImplicitSelf", true, { noImplicitSelf: true }],
240+
241+
["tstlVerbose", true, { tstlVerbose: true }],
242+
243+
["noResolvePaths", [], { noResolvePaths: [] }],
244+
["noResolvePaths", ["path1", "path2"], { noResolvePaths: ["path1", "path2"] }],
238245
])("{ %p: %p }", (optionName, value, expected) => {
239246
const result = parseConfigFileContent({ tstl: { [optionName]: value } });
240247

0 commit comments

Comments
 (0)