typescripttemporal-workflow

How to know if running inside temporal workflow when using TypeScript


How can I know if I'm running inside temporal workflow when using the TypeScript SDK


Solution

  • You can use this:

    import { inWorkflowContext } from '@temporalio/workflow';
    
    if(inWorkflowContext()) {
       // ...
    }