Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed quick fixes for inferred type predicates #58958

Merged
merged 6 commits into from
Jul 26, 2024

Conversation

Andarist
Copy link
Contributor

fixes #58948

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Jun 21, 2024
Comment on lines 1113 to 1121
const result = typePredicateToAutoImportableTypeNode(typeChecker, importAdder, typePredicate, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags | flags, {
moduleResolverHost: program,
trackSymbol() {
return true;
},
reportTruncationError() {
isTruncated = true;
},
});
Copy link
Member

Choose a reason for hiding this comment

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

This looks pretty much the same as typeToTypeNode; why is it that we need a second set of helpers for type predicates? Why can't typeToAutoImportableTypeNode "just work" for these cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because type predicates are neither types nor type nodes 😢

Copy link
Member

Choose a reason for hiding this comment

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

😭

@jakebailey jakebailey merged commit 451388c into microsoft:main Jul 26, 2024
28 checks passed
@Andarist Andarist deleted the quick-fix-type-predicates branch July 26, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Isolated declarations quick fix suggests boolean return type for predicates
4 participants