mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
Add a new unittest for command line parsing for --lib
This commit is contained in:
@@ -518,7 +518,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string) {
|
||||
const map = <Map<number>>opt.type;
|
||||
const map = opt.type;
|
||||
const key = (value || "").toLowerCase();
|
||||
if (hasProperty(map, key)) {
|
||||
return map[key];
|
||||
@@ -529,12 +529,15 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function parseListTypeOption(opt: CommandLineOptionOfListType, value: string): number[] | string[] {
|
||||
const values = (value || "").split(",");
|
||||
function parseListTypeOption(opt: CommandLineOptionOfListType, value: string): (number | string)[] {
|
||||
const values = (value || "").split(",").filter(v => { return v != undefined; });
|
||||
switch (opt.element.type) {
|
||||
case "number": return ts.map(values, parseInt);
|
||||
case "string": return ts.map(values, v => v || "");
|
||||
default: return ts.map(values, v => parseCustomTypeOption(<CommandLineOptionOfCustomType>opt.element, v));
|
||||
case "number":
|
||||
return ts.map(values, parseInt);
|
||||
case "string":
|
||||
return ts.map(values, v => v || "");
|
||||
default:
|
||||
return ts.map(values, v => parseCustomTypeOption(<CommandLineOptionOfCustomType>opt.element, v)).filter(v => { return v != undefined; });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2437,6 +2437,7 @@ namespace ts {
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
allowJs?: boolean;
|
||||
noImplicitUseStrict?: boolean;
|
||||
lib?: string[];
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
|
||||
// Skip checking lib.d.ts to help speed up tests.
|
||||
@@ -2446,7 +2447,7 @@ namespace ts {
|
||||
|
||||
list?: string[];
|
||||
|
||||
[option: string]: string | number | boolean | TsConfigOnlyOptions | string[] | number[];
|
||||
[option: string]: string | number | boolean | TsConfigOnlyOptions | (string | number)[];
|
||||
}
|
||||
|
||||
export interface TypingOptions {
|
||||
|
||||
Reference in New Issue
Block a user