• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* @internal */
2namespace ts.codefix {
3    const fixId = "removeAccidentalCallParentheses";
4    const errorCodes = [
5        Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code,
6    ];
7    registerCodeFix({
8        errorCodes,
9        getCodeActions(context) {
10            const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
11            if (!callExpression) {
12                return undefined;
13            }
14            const changes = textChanges.ChangeTracker.with(context, t => {
15                t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end });
16            });
17            return [createCodeFixActionWithoutFixAll(fixId, changes, Diagnostics.Remove_parentheses)];
18        },
19        fixIds: [fixId],
20    });
21}
22