setTextRange`的作用是什么?编写TypeScript转换时何时需要?

问题描述

这是我在互联网上找到的摘录!它更改了SourceFile statements,但是它是通过setTextRange调用来更改的,我不知道为什么需要它或预期的目的是什么。不是语法...

return ts.updateSourceFileNode(
  sf,ts.setTextRange(
    ts.createNodeArray([
      ...sf.statements.slice(0,firstHoistableNodeIndex + 1),// Inject hoisted variables
      ...hoistedVariables,...transformedStatements
    ]),sf.statements
  )
);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)