// code snippet
export abstract class Foo {
public name!: string;
with tslint.json configuration:
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
}
member-access and whitespace lint errors
no lint errors
@ramanujam-raman have you tried to restart VSCode after updating? It seem to have fixed the problem for me.
@reflectiondm, yes, I have restarted it since. I think the issue is really lack of support for Type Script 2.7.1. The latest update of Visual Studio Code pushes Type Script 2.7.1 as the default, and I needed to revert back to the older version of Type Script just to keep using tslint.
See the new language features in 2.7 here - https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html
+1 I have same issue
restarting vscode worked for me
pay attention to the file tsconfig.json, comment the ("strict": true) in the compilerOptions file
class Engine {
constructor(public horsePower: number,
public engineType: string) { }
}
class Car {
private _engine: Engine;
constructor(engine: Engine) {
this.engine = engine;
}
get engine(): Engine {
return this._engine;
}
set engine(engine: Engine) {
if (engine === undefined) throw 'Supply Engine';
this._engine = engine;
}
}
let engine = new Engine(1000, "awesome");
let car = new Car(engine);
console.log(car.engine.engineType);
Error: Property '_engine' has no initializer and is not definitely assigned in the constructor.
I can turn off the strict property but can't i use it without turning off the strict mode!
Seems like these issues were all around moving to newer TypeScript and TSLint versions.
Quick tip for anyone finding this thread: you can check which version of TypeScript you're using in VS Code with the "Select TypeScript Version" command. 馃槈


Most helpful comment
pay attention to the file tsconfig.json, comment the ("strict": true) in the compilerOptions file