method-signature-style with overloads, what's the recommended practice? #6957
Replies: 2 comments
-
Let me try to summarize: the rule So, if I can guarantee this interface is only implemented in classes whose methods are declared in the second style, then I can safely ignore Is it correct? |
Beta Was this translation helpful? Give feedback.
-
As per our contributing guidelines - please don't use discussions for bug reports or support requests. Instead follow our issues and support workflows: |
Beta Was this translation helpful? Give feedback.
-
Related: #2706, #4106
I enabled
method-signature-style
, here is an exampleThe first style is how Microsoft declare overloading methods in their projects, such as Language Server Protocol. However, it breaks
method-signature-style
. (To reproduce, click the typescript-eslint playgound link)The second and third style is correct for
method-signature-style
, but it fails the type check when implementing those methods in a class. If I remove the overloadingnumber | string
signature, then it fails the type check when invoking method foo of the interface. (To reproduce, click the TS playgound link)TypeScript Playground Link
typescript-eslint Playground
Therefore, I need some suggestions:
Should I just disable
method-signature-style
for those parts, or open an issue in typescript-eslint, or open an issue in TypeScript?Beta Was this translation helpful? Give feedback.
All reactions