I have a variable named Partial<T>
in my coding project.
returnPartial(): Partial<T> {}
proceed(param T) {} //<-- the provided input parameter will always be of type T in this function and cannot be changed
let object = this.returnPartial();
this.proceed(object) //<-- error: Argument of type 'Partial<T>' is not assignable to a parameter of type 'T'.
In some cases, the object
variable actually has the same structure as T
. Therefore, I need to convert or cast it to T
in order to pass it to another function. How can this be achieved?