We know JSON is a data-only format. Comments in the form // or /* */, are not allowed in JSON.
But how tsconfig.json
allow that comment in both formats?
Is there any configuration to allow comments in JSON
files for node.js
projects?
CodePudding user response:
Because tsconfig.json
is not parsed as pure JSON by the TypeScript compiler (it uses a more lenient parser, parseJsonText
).
There is no configuration to allow comments in JSON, because JSON doesn't support comments.
JSON-derived formats such as JSON5 do.