As the title states I get the following TSLint error:
'$http' cannot be declared in the constructor
I couldn't find anything related to this error on the internet.
Here's my code:
module MyModule {
"use strict";
class MyService {
static $inject = ["$http"];
constructor(private $http: ng.IHttpService) {
}
}
}
Just as I posted the question I realized I need to check my tslint.json
file and I found this:
"no-constructor-vars": true,
Apparently, this is documented on tslint's github page:
no-constructor-vars
disallows the public and private modifiers for constructor parameters.
So the solution is simply to disable no-constructor-vars
:
"no-constructor-vars": false,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With