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

Isolated declarations quick fix suggests boolean return type for predicates #58948

Open
bgenia opened this issue Jun 20, 2024 · 2 comments Β· May be fixed by #58958
Open

Isolated declarations quick fix suggests boolean return type for predicates #58948

bgenia opened this issue Jun 20, 2024 · 2 comments Β· May be fixed by #58958
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@bgenia
Copy link

bgenia commented Jun 20, 2024

πŸ”Ž Search Terms

isolated declarations, quick fix, type predicates

πŸ•— Version & Regression Information

TS 5.5+

⏯ Playground Link

https://www.typescriptlang.org/play/?isolatedDeclarations=true#code/GYVwdgxgLglg9mABDAzgZSgJxmA5gCgDcBDAGxAFMAuRcAazDgHcwBKRAbwChFfFMKUEJiRQAngAcKcYIhLkKiALwrEAIhRYcuNVwC+XIA

πŸ’» Code

function isString(value: unknown) {
    return typeof value === "string"
}

πŸ™ Actual behavior

Quick fix suggests 'boolean' return type annotation

πŸ™‚ Expected behavior

Quick fix should suggest the inferred 'value is string` predicate annotation

Additional information about the issue

No response

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Jun 20, 2024
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jun 20, 2024
@RyanCavanaugh
Copy link
Member

cc @danvk

@Andarist Andarist linked a pull request Jun 21, 2024 that will close this issue
@Ankita-lal

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants