can't use IDE automated refactoring to extract method because we can't figure out the types of parameters and variables

fuck you typescript, javascript, graphql

  • 0
    Jetbrains IDEs seem to do the extraction fine for the languages I've tried but doesn't define the type / uses "mixed" instead when it can't figure out the type.l
  • 3
    You are supposed to understand the code you refactor before you do it anyways. So writing the signature yourself really shouldn't be a big deal.
  • 0
    In Typescript or JavaScript, I often use a refactoring step I like to call "defactoring"; converting branches into distinct methods and inlining interface methods by creating a copy of the function on each implementor. It's a grossly inefficient refactoring step that takes forever to correctly execute and by the end you'll reach the same conclusion as you did 10% in (when slightly altering the responsibilities of a method would have been finished), but occasionally it brings forth a brand new pattern tangential to the original design and much more descriptive than it.

    (IMO) Because Typescript gives devs the tools to keep working with flawed abstractions far longer, this technique is often fruitful.
Add Comment