mpellegrini / fullstack-typescript-monorepo-starter

1 stars 1 forks source link

ESLint Toolchain: Implement the @typescript-eslint/method-signature-style rule #139

Closed mpellegrini closed 3 months ago

mpellegrini commented 3 months ago

From a Tuesday Typescript email from Matt Pocock TypeScript Method Shorthand Syntax is Bad

interface Obj {
  // Method shorthand syntax
  version1(param: string): void;
  // Object property syntax
  version2: (param: string) => void;
}

They look very innocuous. But there's a subtle difference between the two. And thanks to a tweet from my friend Andarist, I can now say that method shorthand syntax should be avoided in almost all cases.