Why is console.log() not allowed in tslint?

You can see the common problem people encounter when using tslint in questions like this; tslint says calls to console.log are not allowed – How do I allow this?

Using console.log() in any context in a TypeScript document is considered a fatal error according to tslint. Their official page on the error is here https://palantir.github.io/tslint/rules/no-console/

All they say to justify this rule is;

In general, console methods aren’t appropriate for production code.

I know how to disable this check, but I can’t understand why this is considered a fatal error in the first place. This rationale on their site does very little to explain why, or offer any alternative solutions for that matter.

Does tslint want TypeScript to never output to stdout, or just use an alternative method?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.