utils.ts 383 B

123456789101112
  1. /**
  2. * Since the AST manipulation is blocking, prompts will not get a
  3. * chance to be displayed unless we give a small async pause.
  4. */
  5. export async function pauseForPromptDisplay() {
  6. await new Promise(resolve => setTimeout(resolve, 100));
  7. }
  8. export function isRunningInTsNode(): boolean {
  9. // @ts-ignore
  10. return process[Symbol.for('ts-node.register.instance')] != null;
  11. }