source type
interface DepartMember {
accountId: string;
name: string;
phone: string;
deptNames: string[];
deptIds: string[];
role: number;
}
target type
export interface DepartMemberView extends Omit<DepartMember, 'role' | 'deptNames'> {
role: string;
_role?: DepartMember['role'];
deptNames: string;
_deptNames?: DepartMember['role'];
}
How can I define some TS code to auto convert source type to target type
New contributor
梁自在 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.