Skip to content

consTrue and constFalse both return a boolean instead of the respective narrow types #1749

@vecerek

Description

@vecerek

🐛 Bug report

Current Behavior

constTrue and constFalse are functions that both lazily return a boolean instead of true and false types, respectively.

Expected behavior

I expect constTrue() to return true of type true and constFalse() to return false of type false.

Reproducible example

import { constFalse, constTrue } from "fp-ts/function";

const myFn = (): true => constTrue(); // TS(2322): Type 'boolean' is not assignable to type 'true'.

Suggested solution(s)

Additional context

Your environment

Which versions of fp-ts are affected by this issue? Did this work in previous versions of fp-ts?

Software Version(s)
fp-ts master
TypeScript >= 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions