zth/rescript-relay

Type error with latest `rescript-compiler#master`

Closed this issue · 3 comments

Hi, I think this issue is based on the unstable compiler version, but I want to have a clue to solve to proceed the tests with compiler and JSX v4 on my company project. My company projects are using heavily the relay with rescript-relay.
I found some error.

// RescriptRelay.res

let queryRefToPromise = token => {
    Js.Promise.make((~resolve, ~reject as _) => {
      switch token->queryRefToObservable {
      | None => resolve(. Error())
      | Some(o) =>
        let _: Observable.subscription = o->{
          open Observable
          subscribe(makeObserver(~complete=() => resolve(. Ok()), ()))
        }
      }
    })
  }
  We've found a bug for you!
  /Users/woonki/Github/works/gl/sources/sinsunhi-frontend-mirror/node_modules/rescript-relay/src/RescriptRelay.res:767:21-69

  765 ┆   let _: Observable.subscription = o->{
  766 ┆     open Observable
  767 ┆     subscribe(makeObserver(~complete=() => resolve(. Ok()), ()))
  768 ┆   }
  769 ┆ }

  This has type: Observable.observer<'a>
  Somewhere wanted: Observable.t<'b>

I think I can fix it as below

         let _: Observable.subscription = {
          open Observable
          subscribe(o, makeObserver(~complete=() => resolve(. Ok()), ()))
        }

But, I face many build error from different places in my projects.

image

Can I get a tip to fix the build error?

zth commented

This is actually already fixed in fbc78b8 but not released yet. I'll make a rc.5 tonight with the fix.

This is actually already fixed in fbc78b8 but not released yet. I'll make a rc.5 tonight with the fix.

Lovely! Thank you! 👍

zth commented

@mattdamon108 1.0.0-rc.5 is out now.