tardis icon indicating copy to clipboard operation
tardis copied to clipboard

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

Open edman opened this issue 4 months ago • 1 comments

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

edman avatar Oct 08 '24 18:10 edman