Let's say I have a generic type like bellow
type GeneratePipeline<T = any> = {
localField: keyof T;
}
and interface User
interface User {
email : string,
password : string,
generalInfo : {
firstName: string
lastName : string
departmentId : string
}
}
then I Create a type for GeneratePipeline by User
const UserPipeLine :GeneratePipeline<User> = {
localField : "generalInfo.departmentId"
}
Typescript throws an error at the line "generalInfo.departmentId".
How can I solve this issue? Thanks