You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One problem with this is related to typing of ts.ExpressionStatement vs ExpressionStatement, but that's fine.
However, when I try to getText(), I get the following error:
Error: Debug Failure. False expression: Node must have a real position for this operation
I get that there is no associated source file, but shouldn't there be some way to extract the textual representation of a successfully created ExpressionStatement? I can't even add it to a source file, because to do that, I need to use stringified statements, which runs into the same problem.
The end goal here is to split up my project into more testable pieces, but it looks like I have to pass around SourceFile to every method.
The text was updated successfully, but these errors were encountered:
Great library! I ported from the regular
typescript
compiler for some of the nice bells and whistles.However, I'm run into a "problem" that I have workarounds for, but I'm having a hard time believing there isn't a proper solution for.
I have a function of the form:
Which will take in some line of code, and emit it as multiple expressions according to some rules.
I can't seem to find a
ts-morph createExpressionStatement
type of method, so I tried to use thets
factory.newStatements.push(ts.factory.createExpressionStatement(...))
One problem with this is related to typing of
ts.ExpressionStatement
vsExpressionStatement
, but that's fine.However, when I try to
getText()
, I get the following error:I get that there is no associated source file, but shouldn't there be some way to extract the textual representation of a successfully created ExpressionStatement? I can't even add it to a source file, because to do that, I need to use stringified statements, which runs into the same problem.
The end goal here is to split up my project into more testable pieces, but it looks like I have to pass around
SourceFile
to every method.The text was updated successfully, but these errors were encountered: