I am converting an object one to other type in typescript. But the returned object has properties of original object. I want to get OutputInterface
format, not with InputInterface
.
export interface InputInterface {
username: string;
createdAt: number;
active: boolean;
roles: any;
}
export interface OutputInterface {
username: string;
active: number;
roles: any;
}
const i: InputInterface = {
username: "username",
createdAt: 1,
active: true,
roles: []
};
const converted = (i as unknown) as OutputInterface;
console.log("final value", converted);
// final value { username: 'username', createdAt: 1, active: true, roles: [] }