effect icon indicating copy to clipboard operation
effect copied to clipboard

When specified with zero type arguments, errors Data.TaggedError should not require a runtime argument

Open mattpocock opened this issue 6 months ago • 4 comments

What version of Effect is running?

Whatever version the playground runs

What steps can reproduce the bug?

https://effect.website/play#9896abe46cfe

What is the expected behavior?

No runtime argument should be required

What do you see instead?

A runtime argument is required, of void 0

Additional information

No response

mattpocock avatar Jun 22 '25 08:06 mattpocock

BTW The recommended approach is to use classes because they provide opaque identifiers in type hints, which are more pleasant to work with during development.

Image

KhraksMamtsov avatar Jun 22 '25 09:06 KhraksMamtsov

Beautiful, I was just wondering about that. Thanks!

mattpocock avatar Jun 22 '25 11:06 mattpocock

You'll see the same pattern in multiple places. Context.Tag, Effect.Service, Schema.Class (and all its variants) and many more. The syntax can be a bit odd, but it has its benefits for readability (especially LSP).

fubhy avatar Jun 22 '25 12:06 fubhy

Sure, but there are docs where no args are passed

mattpocock avatar Jun 22 '25 20:06 mattpocock