Currently, I am in the process of developing a procedure that scans through a collection of *.ts files within a directory to identify those containing a class that implements a specific interface. While my preference is to be able to detect multiple classes within one file, I am content with managing just one.
My current approach involves loading the files, initializing constructors, and verifying the presence of certain properties; however, complications arise when encountering enums which lead to exceptions being thrown.
I understand that interfaces lack a runtime equivalent, preventing direct type checks against them. Are there alternative techniques available for identifying whether a file's contents represent a class or enum?
EDIT: The situation I am dealing with revolves around an interface defining an Express.js route. A singular class scans all files in a designated folder, aiming to load each one dynamically. For every file, my objective is to ascertain whether it aligns with the IRouteDefinition type and proceed to load its associated route and handler accordingly.