You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some feedback for small improvements that could substantially improve the initial experience when working with random tsconfigs
When the tsconfig.json is incompatible with ts-node, we currently get an error like so:
SyntaxError: Unexpected token ] in JSON at position 152
at JSON.parse (<anonymous>)
at parse (/usr/local/opt/nvm/versions/node/v8.5.0/lib/node_modules/ts-
...
What would be great is if a JSON-schema or similar was defined for the tsconfig, and the incoming tsconfig.json was validated against the schema first before attempting to use it, so the error would then be something like:
ValidationError: tsconfig.json cannot have "include" member
An example of a ts-node compatible tsconfig in the documentation would also be useful - perhaps this can be driven off the same json-schema.
Let me know if you agree and what techniques you prefer and point me to where the most suitable places to make the changes and I'll do a pull request.
All the best.
The text was updated successfully, but these errors were encountered:
JSON schema would not tell you your JSON is invalid as you'd still need to parse it to validate. What exactly are you suggesting? The correct fix would be to use TypeScript to load the tsconfig.json file if that API is properly exposed.
It seems the problem is not that it's invalid JSON, but rather that the tsconfig has fields that cannot be processed by ts-node, like 'include'. IE I've found through trial and error that if I remove 'include', it will work. So I'm proposing we include some post-parsing validation into ts-node to make sure the tsconfig is acceptable. I'd prefer to use JSON schema to do this, but I'm ok with hardcoding it as well if that suits the coding style of the project.
As far as I know, that's not the case. Would you like to make an example that can reproduce your issue? If the JSON is valid, you won't have a syntax error, so I'm not quite sure I follow how you landed in this issue.
Hi, this is a fantastic project, thanks for it.
I have some feedback for small improvements that could substantially improve the initial experience when working with random tsconfigs
When the tsconfig.json is incompatible with ts-node, we currently get an error like so:
What would be great is if a JSON-schema or similar was defined for the tsconfig, and the incoming tsconfig.json was validated against the schema first before attempting to use it, so the error would then be something like:
An example of a ts-node compatible tsconfig in the documentation would also be useful - perhaps this can be driven off the same json-schema.
Let me know if you agree and what techniques you prefer and point me to where the most suitable places to make the changes and I'll do a pull request.
All the best.
The text was updated successfully, but these errors were encountered: