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

FR: upgrade Boolean to be a type assertion function #213

Open
jasikpark opened this issue Nov 22, 2024 · 0 comments
Open

FR: upgrade Boolean to be a type assertion function #213

jasikpark opened this issue Nov 22, 2024 · 0 comments

Comments

@jasikpark
Copy link

jasikpark commented Nov 22, 2024

Implement #138 w/in ts-reset

When using code like

const isReady = Boolean(downloadURL);

return isReady ?
          <LinkButton fullWidth href={downloadURL} download={fileName}>
            Download
          </LinkButton>
        : null;

downloadURL is considered falsey still in the ternary. With this change to global types:

interface BooleanConstructor {
  // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
  new (value?: unknown): Boolean;
  <T>(value?: T): value is TSReset.NonFalsy<T>;
  // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
  readonly prototype: Boolean;
}

It typechecks fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant