I'm trying to create a process that looks at a bunch of *.ts files in a folder and determines which ones contain a class that implements a specific interface. While I'd like to be able to include multiple classes in one file, I'm fine if I can only do one.
At present, I'm simply loading the files, calling the constructor and then checking for the existence of a few properties, but some of these files may contain enums which are throwing exceptions.
I know interfaces don't have a runtime equivalent so I can't do a type check against them, but is there another option to check if what's in a file is a class / enum?
EDIT: The scenario is that I have an interface that defines an Express.js route. I then have a single class that looks at all the files in a folder and will load each one. For each file, I want to see "if it is of type IRouteDefinition then dynamically load its route & handler"