在打字稿中它看起来像这样
type Option<T> = {some: T} | 'none'
type Optional<T> = {
[P in keyof T]: Option<T[P]>
};
type Foo = {x: string, y: number}
type OptionalFoo = Optional<Foo>
const foo: OptionalFoo = {x: 'none', y : {some: 123}}
case class Foo(x: String, y: Int)
我想拥有
type OptionalFoo = Optional[Foo] == case class OptionalFoo(x: Option[String], y: Option[Int])
是否有可能在 Scala 3 中实现这样的目标?