I am currently working on a function named createFactory, which requires two parameters - a model and a data object. The purpose of this function is to generate a document based on the provided data.
const createFactory = (Model, obj: object) => {
Model.create(obj)
}
However, TypeScript is issuing a warning because the type of Model is not specified. As a result, when I attempt to access properties or methods of Model in VScode by typing "Model." and pressing ctrl+space, code completions are not displayed.
What is the correct way to address this issue in my code?