Need help on how to import some less obvious types from the SDK

Hello, it’s been a few times now where I’ve had an issue importing a type from the typescript SDK so that I can use it and reference it in my code.

For example, I can’t figure out how to import the WorkflowNotFoundException, which means I cant catch that error type and use it in my code.

Another example was trying to import the WorkflowExecutionStatus type.

Is there something I’m missing? How can I import both of those types into my TS code?


Some of the export are only available in the common package and the proto package.

In your case you’d need to use:

import { WorkflowNotFoundError } from '@temporalio/common';
import { temporal } from '@temporalio/proto';

WorkflowNotFoundError is also re-exported from @temporalio/workflow and @temporalio/client for convenience.

Thanks for your response bergundy. Your first comment works fine, indeed the WorkflowNotFoundError can be found in the common package. Maybe the docs could be updated to reflect that? Because there is no intuitive way to discover that.

Regarding your second post,

import { WorkflowNotFoundError } from '@temporalio/workflow';

Does not work. Unless its hidden deeper in the package somewhere.

What version are you on? It should work in v1.0.0

The two ways to discover it in the docs are to use search or click workflow package and scroll or cmd-F

I’m on 0.21.1, that might be the problem