How to force proper second argument type for tthe createMessage method
const EMAIL_TEMPLATES = {
DOCTOR_SIGNUP: DoctorSignupOutput,
CHANGE_PASSWORD: PasswordParams
} as const;
@Injectable()
export class EmailService {
sendEmail() {
console.log('Email sent!');
}
createMessage(template: keyof typeof EMAIL_TEMPLATES, params: ?) {
}
}
so i.e. only objects of type DoctorSignupOutput are allowed when template equals DOCTOR_SIGNUP?