Skip to content

Receiver.map() doesn't preserve the original receiver's type #239

Closed as not planned
@llucax

Description

@llucax

What happened?

When calling map() on a receiver, the returned type is of type _Map and tying-wise it is an abstract Receiver, this means that when mapping a receiver that has more methods, like .close() for merging or .reset() for Timer, these methods are not available anymore after .map() is used.

What did you expect instead?

I expect the type to be preserved, so the mapped receiver can be used the same way as the original receiver.

Extra information

The only way to fix this is probably to have some mapping logic inside Receiver itself instead of returning a new type. That or removing .map() and just let users do the transformation themselves when consuming from the receiver.

Metadata

Metadata

Assignees

Labels

part:coreAffects the core types (`Sender`, `Receiver`, exceptions, etc.)type:bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions