Sitelet https://github.com/microsoft/TypeScript/pull/49727
Skip to content

Account for type parameters in missing function codefix - #49727

Merged
Nathan Shively-Sanders (sandersn) merged 10 commits into
microsoft:mainfrom
JoshuaKGoldberg:codefix-missing-function-generic
Jul 26, 2022
Merged

Nathan Shively-Sanders (sandersn) merged 10 commits into
microsoft:mainfrom
JoshuaKGoldberg:codefix-missing-function-generic

Conversation

@JoshuaKGoldberg

@JoshuaKGoldberg Josh Goldberg ✨ (JoshuaKGoldberg) commented Jun 29, 2022 •

Copy link
Copy Markdown
Contributor

In addition to any explicit type parameters, also accounts for any type parameters in the types of arguments.

I noticed both callers of typeToAutoImportableTypeNode use checker.getBaseTypeOfLiteralType, so I deduplicated & moved that inside the function. Edit: no longer true as of #50004. Reverted.

Fixes #49693

@typescript-bot TypeScript Bot (typescript-bot) added the For Backlog Bug PRs that fix a backlog bug label Jun 29, 2022
@JoshuaKGoldberg
Josh Goldberg ✨ (JoshuaKGoldberg) marked this pull request as ready for review June 29, 2022 16:47
Comment thread src/services/codefixes/helpers.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial comments, although I still need to read getArgumentTypesAndTypeParameters more closely

Comment thread src/services/codefixes/helpers.ts Outdated
Comment thread src/services/codefixes/helpers.ts Outdated
Comment thread src/services/refactors/extractSymbol.ts Outdated
Comment thread tests/cases/fourslash/incompleteFunctionCallCodefixTypeKeyof.ts Outdated
Comment thread tests/cases/fourslash/incompleteFunctionCallCodefixTypeParameterConstrained.ts Outdated
Comment thread src/services/codefixes/helpers.ts Outdated
Comment thread src/services/codefixes/helpers.ts Outdated
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
@JoshuaKGoldberg
Josh Goldberg ✨ (JoshuaKGoldberg) marked this pull request as draft July 22, 2022 22:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add Missing Function Declaration: Does Not Correctly Declare Generic Function

3 participants