Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add explicit type in customizations.md code #1586

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/src/main/markdown/customizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ package mydomain
case class Seconds(v: Int) extends AnyVal

object Seconds {
implicit val typeMapper = TypeMapper(Seconds.apply)(_.v)
implicit val typeMapper: TypeMapper[Int, Seconds] = TypeMapper(Seconds.apply)(_.v)
}
```

Expand Down Expand Up @@ -548,7 +548,7 @@ goes into the `a.b.c` package, you can define the type mapper like this:
package a.b

package object c {
implicit val segmentType =
implicit val segmentType: TypeMapper[SegmentType, String] =
TypeMapper[SegmentType, String](_.name)(SegmentType.fromName(_).get)
}
```
Expand Down Expand Up @@ -584,7 +584,7 @@ import mytypes.duration.Duration
case class MyDurationClass(seconds: Int)

object MyDurationClass {
implicit val tm = TypeMapper[Duration, MyDurationClass] {
implicit val tm: TypeMapper[Duration, MyDurationClass] = TypeMapper[Duration, MyDurationClass] {
d: Duration => MyDurationClass(d.seconds) } {
m: MyDurationClass => Duration(m.seconds)
}
Expand Down