Hey there everyone, I have a custom generic type called P
that is defined as
P extends Record<string, unknown> | void
I am looking to create an exists
function
export class Parameters<P extends Record<string, unknown> | void> {
private params: P
constructor(params: P) {
this.params = params
}
public exists(field: keyof P): boolean {
return field in this.params
}
}
However, I encountered a compilation error when running tsc
because it cannot be applied to the void
type. Any suggestions on how to resolve this issue inside my exists
function?
tsc
Typescript version 4.9.3
Thanks!