ts-morph
ts-morph copied to clipboard
Tracing diagnostics back to the original node
Hi there!
I have a bit of an unusual requirement, I've been trying to find a way to keep track of the original nodes provided before transforming - and then use ts-morph to typecheck those statements in a different context/wrapper.
ts-morph has unlocked a huge part of the solution in that the bindings get updated on ast modification :raised_hands: .
What I'm trying to achieve is providing feedback to less-technical users (who can still swing some code) without them having to setup imports and all sorts of boilerplate.
I've tried to detail the requirement as best I can over here: https://github.com/OpenFn/kiini/issues/2
Any recommendations on how ts-morph could help or any complimentary projects would be really appreciated.
I think the only way to do this would be to use diagnostic.getStart() and diagnostic.getLength() then use sourceFile.getDescendantAtStartWithWidth(diagnostic.getStart(), diagnostic.getLength() to try to get the Node.