Skip to content

"Infer function return type" is annoyingly suggested in function bodies #42714

Closed
@DanielRosenwasser

Description

@DanielRosenwasser
function foo() {
    let x = 123;
    return x;
}

If your cursor is anywhere in the body of this function, you will get a code action to "Infer function return type".

This is annoying because it always provides a lightbulb in the editor

image

and that is doubly-annoying in cases where you think you have a quick fix but it ends up being the same useless code action.

image

I'm not exactly sure what the right way is to surface this refactoring in a way that's not intrusive. Maybe by only providing it on return statements and the function signature itself? Thoughts @jessetrinity @sandersn?

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbolEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions