Is there a way to determine the file where a specific type was defined given a ts.Program
and the name of the type? The type will always exist in the program and be exported from the main entry point.
I am looking for guidance on which APIs to use or an example similar to what I described. One potential starting point could involve using program.getTypeChecker()
to obtain a ts.TypeChecker
, but none of its methods seem to offer a direct solution to map from a type name to its origin.
(While VS Code's "go to definition" feature is somewhat comparable, it operates through multiple layers of abstraction and does not provide a helpful demonstration in this context.)