title: Replacing a expression with a return statement in TypeScript transformer results in "Debug Failure. Unhandled SyntaxKind: ReturnStatement"
body: <p>I'm trying to write a TypesScript transformer to transform a specific function call to a return statement using the following transformer.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>export default function transformer(program: ts.Program, config?: PluginConfig): ts.TransformerFactory&lt;ts.SourceFile&gt; {
    const transformerFactory: ts.TransformerFactory&lt;ts.SourceFile&gt; = context =&gt; {
      return sourceFile =&gt; {
        const visitor = (node: ts.Node): ts.Node =&gt; {
          if (ts.isCallExpression(node) &amp;&amp; node.expression.getText(sourceFile).indexOf("someFunction") != -1) {
            const factory = context.factory;
            if (node.arguments.length != 2) {
              throw new Error("The argument list is not of size 2");
            }
            
            return factory.createReturnStatement(factory.createStringLiteral("1"));
          }
          return ts.visitEachChild(node, visitor, context);
        };
  
        return ts.visitNode(sourceFile, visitor);
      };
    };
    return transformerFactory;
  }</code></pre>
  </div>
  </div>
  </p>
  <p>When I run the transformer with ttypescript, I get <code>Debug Failure. Unhandled SyntaxKind: ReturnStatement</code>.
  After some digging, I find that the problem is that tsc thinks the new node(return statement) is still an expression(EmitHint == 1).
  Is it possible to replace a expression with a statement inside a TypeScript transformer?</p>