Skip to content
Advertisement

How to create generic function in TS and TypeORM?

How to create generic function in TS and TypeORM?

I have a multiple functions like this:

JavaScript
JavaScript

and another … another… another…

so, i need to create one generic function to use with the many entities

can somebody tell me how to create that function?

Advertisement

Answer

You should be able to take advantage of duck typing to generalize the functionality over EntityTargets:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement