实现高级工具类型 GetOptional<T>,该类型保留所有可选属性
例如
type I = GetOptional<{ foo: number, bar?: string }> // expected to be { bar?: string }
import type { Equal, Expect } from '@type-challenges/utils'
type cases = [
Expect<Equal<GetOptional<{ foo: number, bar?: string }>, { bar?: string }>>,
Expect<Equal<GetOptional<{ foo: undefined, bar?: undefined }>, { bar?: undefined }>>,
]