I'm making a command line nodejs tool that automates renaming symbols in Typescript files, using the Typescript language services.
You tell the tool: rename all symbols of this type to this symbol. Just like resharper, it will also rename local variables, properties, etc. Since it allows renaming multiple symbols at once, you can also swap two symbol names, without needing an intermediate temporary unique name (e.g. rename Foo to Bar and vice vesa).
I had to make the private function getSymbolInfoAtPosition in the language service public to make this work, so that I can get PullSymbol information
Currently it only detects exact name+type matches, by calling getNameAndTypeName on the PullSymbol, but I would like to perform structurally compatible matches.
In C#, this is easy, since a Type has an IsAssignableFrom method.
Does anyone know how the Typescript compiler-as-a-service can be used to detect if one PullSymbol is structurally compatible with another PullSymbol?
Thanks a lot, Peter Verswyvelen