What is the recommended way to achieve the desired outcome and how can I limit property when type casting?
interface user {
name: string
password: string
}
interface userEntity {
name: string
}
const user: user = {
name: 'name',
password: 'password'
}
const result = user as userEntity;
// output { name: 'name', password: 'password' }
// expected { name: 'name' }