ghivert / tardis

Time traveller debugger, tailor-made for Lustre! Rewind your history, and see what you've done!
https://hexdocs.pm/tardis
MIT License
27 stars 0 forks source link

Expected type ... SketchError ... found type ... Error on tardis 0.2 #6

Open edman opened 1 month ago

edman commented 1 month ago

I get build errors in my app on gleam run -m lustre/dev build after updating tardis to 0.2.

  Compiling tardis
error: Type mismatch
    ┌─ /client/build/packages/tardis/src/tardis.gleam:134:17
    │
134 │   |> result.try(start_lustre(lustre_root, _))
    │                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expected type:

    fn(App(Nil, Model, Msg)) ->
      Result(fn(Action(Msg, ClientSpa)) -> Nil, SketchError)

Found type:

    fn(App(Nil, Model, Msg)) -> Result(fn(Action(Msg, ClientSpa)) -> Nil, Error)

It looks like gleam's type checker infers different types for sketch.cache depending on the target.

This returns a Result(Cache, a) https://github.com/ghivert/sketch/blob/main/sketch/src/sketch.gleam#L77

While this returns a Result(Cache, SketchError) https://github.com/ghivert/sketch/blob/main/sketch/src/sketch.gleam#L88

ghivert commented 1 month ago

Hi! Could you show your start_lustre function?