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

Piping output differs from input and fails? #175

Closed
arichiardi opened this issue May 10, 2017 · 3 comments
Closed

Piping output differs from input and fails? #175

arichiardi opened this issue May 10, 2017 · 3 comments

Comments

@arichiardi
Copy link

Hello!

I got this:

2017-05-10-152040_572x118_scrot

And error:

13   return R.pipe(
     ~~~~~~~~~~~~~~
14     R.evolve(aggregateSanitation),
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15     R.props(["domain", "name", "id"])
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16   )(aggregate);
   ~~~~~~~~~~~~~~~

src/impl/file-persistence.ts(13,3): error TS2322: Type '{}[]' is not assignable to type 'string[]'.
  Type '{}' is not assignable to type 'string'.

I solved with casting, but I was wondering whether there is a better way to fix it?

Thanks a lot for typing ramda!

@arichiardi
Copy link
Author

arichiardi commented May 10, 2017

This also solves:

interface PropsFn { (obj: any): string[]; };

function aggregate(aggregate: AggregateIdentifier): string[] {
  return R.pipe(
    R.evolve(aggregateSanitation),
    <PropsFn>R.props(["domain", "name", "id"])
  )(aggregate);
}

@KiaraGrouwstra
Copy link
Member

Yeah, it's our top issue, minimum repro being R.pipe(R.identity) (reason: presence of generics it does not yet have the info to resolve, instead yielding {}). A fix would pretty much require TypeScript to better prioritize this. Feel free to upvote / voice your support over there, for what it's worth.

@KiaraGrouwstra
Copy link
Member

This issue is still a thing, but I'll close as dupe of #86.

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

2 participants