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

TS2349: This expression (Result<?, ?>.else) is not callable #4

Closed
Jack-Works opened this issue Feb 4, 2020 · 3 comments · Fixed by #9
Closed

TS2349: This expression (Result<?, ?>.else) is not callable #4

Jack-Works opened this issue Feb 4, 2020 · 3 comments · Fixed by #9

Comments

@Jack-Works
Copy link
Contributor

Code:

declare function work(): Result<boolean, void>
work().else(true)
// And I think it should accept a function as well `.else(() => heavyWork())`

Error:

(property) else: (<T2>(val: T2) => boolean) | (<T2>(val: T2) => T2)

This expression is not callable.

Each member of the union type
        '(<T2>(val: T2) => boolean) | (<T2>(val: T2) => T2)' has signatures,
but none of those signatures are compatible with each other.(2349)

Playground link

@vultix
Copy link
Owner

vultix commented Feb 4, 2020

I'd be more than willing to accept a PR for this change.

@GabrielCTroia
Copy link

GabrielCTroia commented May 28, 2020

I'm not sure how the else functionality was initially designed but it doesn't seem to work at all, at least in TS 3.8+. I know this is more of a typescript issue 33591 or 7294, but imho it should either be removed or a workaround found.

This being said I'd be more than willing to give it a try once I get some time.

@Jack-Works Jack-Works mentioned this issue Jun 3, 2020
@Jack-Works
Copy link
Contributor Author

I found a fix for this. Please wait

@vultix vultix closed this as completed in #9 Jul 2, 2020
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

Successfully merging a pull request may close this issue.

3 participants