Following on the heels of Mapped types in Scala
Is there a way to mimic Pick
, Exclude
, Diff
and etc. from Typescript in Scala?
Using the a similar example as above:
case class Person(name: String, age: Int, address: String, phone: String)
is there a way to derive a type
class PersonSubset(name: String, age: Int)
without having to explicitly write out a separate case class?
As in following more of a Typescript approach, could we create a type alias that is a subset of fields of class Person
?
SELECT name, age FROM Person
or GraphQL. – Yemane