How to Handle 'no-console Calls to console.log are not allowed' Error in TypeScript
I’ve come across this no-console
error quite a few times when writing TypeScript.
ERROR: no-console Calls to 'console.log' are not allowed.
The quick way to handle a one-off instance of this is to disable the linter for our console.log()
line.
// tslint:disable-next-line:no-console
console.log("No errors!");
We can handle all instances of this error by heading over to our tslint.json
and adding this rule.
{
"rules": {
"no-console": false
}
}
Be sure to restart your application to see the changes in effect.