Is there a way to utilize keyof in defining function parameters based on an optional field within an Object, while also including a default value?
interface test {
example?: {
choice1: string,
choice2: string
}
}
function sample(param: keyof test["example"] = "choice1") ...
Encountering the error
Type 'string' is not assignable to type 'never'
due to the optional nature of example
.