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

Typescript 5.5 types behave poorly #711

Closed
stijnveenman opened this issue Jun 24, 2024 · 7 comments
Closed

Typescript 5.5 types behave poorly #711

stijnveenman opened this issue Jun 24, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@stijnveenman
Copy link

Since typescript 5.5, type inference has been improved. This update affected purify-ts type inference in annoying ways. Previously, the following examples used to work

import {Maybe} from 'purify-ts';

const foo = (bar: Maybe<number>) => {
    return bar;
}

console.log(foo(Maybe.zero()));
                ^^^^^^^^^^^^^
Argument of type 'Nothing' is not assignable to parameter of type 'Maybe<number>'.
  Types of property 'isJust' are incompatible.
    Type '() => boolean' is not assignable to type '() => this is AlwaysJust'.
      Signature '(): boolean' must be a type predicate.(2345)
import {Nothing, Just} from 'purify-ts';

export const foo = (a: number) => {
             ^^^
Exported variable 'foo' has or is using name 'AlwaysJust' from external module "file:///node_modules/purify-ts/Maybe" but cannot be named.(4023)
Property '__value' of exported class expression may not be private or protected.(4094)

    return a ? Nothing : Just(5)
}
@gigobyte gigobyte added the bug Something isn't working label Jun 24, 2024
@valpinkman
Copy link

It seems the repo has been updated to use Typescript 5.5.2 about two weeks ago. Any chance to see a new release soon ?

@gigobyte
Copy link
Owner

gigobyte commented Jul 5, 2024

The packages are automatically updated by renovate so it does not imply any compatibility unless there is a release with the updated packages. I'll get to investigating the bug this weekend.

@valpinkman
Copy link

@gigobyte thank you very much 🙏

@gigobyte
Copy link
Owner

gigobyte commented Jul 7, 2024

Test pass for 2.1.0 on my machine, please try it out and close the issue if it's not reproducible anymore.

@valpinkman
Copy link

Thanks will try and report

@valpinkman
Copy link

Works on our side 👍

@stijnveenman
Copy link
Author

We have now been able to update as well, thanks for the quick fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants