async emailSend(mailData: IMail<Record<string, unknown>>) {async emailSend(mailData: IMail<IEmailUser | IEmailOther1 | IEmailOther2 | etc>) {async emailSend<T extends Record<string, unknown>>(mailData: IMail<T>)
context?: {
[name: string]: any;
};export interface IMail {
to: string
subject: string,
template: string,
context: Record<string, unknown>;
}
function testFn<K extends TestKeys>(
obj: Partial<Type>, key: K
): Type[K]['value'] | undefined {
return key in obj ? obj[key]!.value : undefined
}
function getCampaigns () {
return knex('call as cc')
.where({
'cc.is_obsolete': false,
'cc.is_active': true,
})
.whereNotIn('cc.type_id', TYPES)
.select(
'cc.id',
'cc.value as config',
'cc.type_id as sale_type_id'
).catch(() => {/* здесь тот же код, который в кетч из первого */});
}
apply- тоже функция, и у неё, как у любой функции, есть методcall, как раз из прототипа.