Answer the question
In order to leave comments, you need to log in
What is the difference between using generics and specifying a literal?
Good evening, there is such a design:
import type { Model, ModelCtor } from 'sequelize';
const isExistsValidator = (model: ModelCtor<Model>, field: string) => { ... }
export type ModelCtor<M extends Model> = typeof Model & { new(): M };
import type { Model, ModelCtor } from 'sequelize';
const isExistsValidator = <M extends Model>(model: ModelCtor<M>, field: string) => { ... }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question