ts-codemod-lib
    Preparing search index...
    • Determines if parentheses should be avoided when adding 'readonly' prefix to a type.

      Parentheses should be AVOIDED in these specific contexts:

      • Type predicates: x is [T, U] -> x is readonly [T, U] (not x is (readonly [T, U])) because parentheses around the type in a type predicate cause syntax errors

      For all other contexts, we keep parentheses for safety to avoid precedence issues, relying on prettier to remove unnecessary ones.

      Parameters

      • node: Node

        The type node to check

      Returns boolean

      true if parentheses should be avoided, false otherwise (keep parentheses)