In TypeScript I can define methods like a real method (Foo
) or a property which gets a method assigned (Baz
).
class TestClass {
private mText: string = "test";
public Baz = (): void => {
console.log(this.mText);
}
public Foo(): void {
console.log(this.mText);
}
}
typescript-eslint
to forbid one of them?They are not equivalent. Baz
would not be on the prototype of TestClass
(Foo
would), but it would be a property on each instance.