sveltekit-flash-message icon indicating copy to clipboard operation
sveltekit-flash-message copied to clipboard

Improve types for the load wrapper

Open fehnomenal opened this issue 7 months ago • 1 comments

Before this change you would just get a "generic" ServerLoadEvent, i.e. without params or route id set:

grafik

Adding satisfies LayoutServerLoad to the passed function works but gives an error about the route id:

grafik

  Type 'string | null' is not assignable to type 'LayoutRouteId'.
    Type 'string' is not assignable to type 'LayoutRouteId'.ts(2345)

After this change no error is shown and not even the satisfies is needed (at least for autocomplete; I think eslint still requires it).

fehnomenal avatar Apr 25 '25 09:04 fehnomenal

Thank you! Will merge asap when I've checked it out locally.

ciscoheat avatar Apr 25 '25 10:04 ciscoheat