(sourceFile, errors, reportOptionsErrors, optionsIterator)
| 40933 | return _tsconfigRootOptions; |
| 40934 | } |
| 40935 | function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, optionsIterator) { |
| 40936 | var _a; |
| 40937 | var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; |
| 40938 | var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; |
| 40939 | if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { |
| 40940 | errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); |
| 40941 | // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by |
| 40942 | // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that |
| 40943 | // array is a well-formed configuration object, made into an array element by stray characters. |
| 40944 | if (ts.isArrayLiteralExpression(rootExpression)) { |
| 40945 | var firstObject = ts.find(rootExpression.elements, ts.isObjectLiteralExpression); |
| 40946 | if (firstObject) { |
| 40947 | return convertToObjectWorker(sourceFile, firstObject, errors, /*returnValue*/ true, knownRootOptions, optionsIterator); |
| 40948 | } |
| 40949 | } |
| 40950 | return {}; |
| 40951 | } |
| 40952 | return convertToObjectWorker(sourceFile, rootExpression, errors, /*returnValue*/ true, knownRootOptions, optionsIterator); |
| 40953 | } |
| 40954 | /** |
| 40955 | * Convert the json syntax tree into the json value |
| 40956 | */ |
no test coverage detected