mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-20 22:51:17 -05:00
Using removeComments from commandLineParser. This is more robust as it removes both single and multiline comments
This commit is contained in:
@@ -21,8 +21,7 @@ namespace ts.JsTyping {
|
||||
function tryParseJson(jsonPath: string, host: TypingResolutionHost): any {
|
||||
if (host.fileExists(jsonPath)) {
|
||||
try {
|
||||
// Strip out single-line comments
|
||||
const contents = host.readFile(jsonPath).replace(/^\s*\/\/(.*)$/gm, "");
|
||||
const contents = removeComments(host.readFile(jsonPath));
|
||||
return JSON.parse(contents);
|
||||
}
|
||||
catch (e) { }
|
||||
|
||||
Reference in New Issue
Block a user