mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 20:33:45 -05:00
Only copy non error values in array when converting the json
Fixes #27432
This commit is contained in:
@@ -1529,7 +1529,12 @@ namespace ts {
|
||||
elements: NodeArray<Expression>,
|
||||
elementOption: CommandLineOption | undefined
|
||||
): any[] | void {
|
||||
return (returnValue ? elements.map : elements.forEach).call(elements, (element: Expression) => convertPropertyValueToJson(element, elementOption));
|
||||
if (!returnValue) {
|
||||
return elements.forEach(element => convertPropertyValueToJson(element, elementOption));
|
||||
}
|
||||
|
||||
// Filter out invalid values
|
||||
return filter(elements.map(element => convertPropertyValueToJson(element, elementOption)), v => v !== undefined);
|
||||
}
|
||||
|
||||
function convertPropertyValueToJson(valueExpression: Expression, option: CommandLineOption | undefined): any {
|
||||
|
||||
Reference in New Issue
Block a user