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

fix: add predicate for isBoolean #1300

Closed
heyqbnk opened this issue Sep 18, 2021 · 2 comments
Closed

fix: add predicate for isBoolean #1300

heyqbnk opened this issue Sep 18, 2021 · 2 comments
Labels
status: done/released Issue has been completed, no further action is needed. type: fix Issues describing a broken feature.

Comments

@heyqbnk
Copy link

heyqbnk commented Sep 18, 2021

Description

Hey, I have found one little bug in types. isBoolean should have a predicate which states, that value is boolean.

Minimal code-snippet showcasing the problem
Here is a simple example. TypeScript will keep thinking, val is 123, but isBoolean should make him think, its boolean.

function getRandomType(): string | number | boolean {
  return 'No random in our life';
}

const val = getRandomType(); // val here is string, or number, or boolean

if (isBoolean(val)) {
  const someAnotherVal = val; // someAnotherVal will have type string, or number, or boolean, but it should be clear boolean
}

Expected behavior

TypeScript knows that value has type boolean.

Actual behavior

isBoolean returns boolean value without predicate, so, it does not say anything for TypeScript.

@heyqbnk heyqbnk added status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. labels Sep 18, 2021
@NoNameProvided NoNameProvided added status: done/released Issue has been completed, no further action is needed. and removed status: needs triage Issues which needs to be reproduced to be verified report. labels Dec 16, 2022
@NoNameProvided
Copy link
Member

I think this is already in 0.14.0.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: done/released Issue has been completed, no further action is needed. type: fix Issues describing a broken feature.
Development

Successfully merging a pull request may close this issue.

2 participants