# Tips for Integrating a TypeScript SDK into a Monorepo
Source: https://speakeasy.com/guides/sdks/typescript-monorepo-tips

import { Callout } from "@/mdx/components";



<Callout title="Get Started">
  If you're looking to set up a monorepo from scratch, check out our [Create a
  monorepo](/guides/sdks/creating-a-monorepo) guide first.
</Callout>

## Dependency Confusion

The most common issue we see is dependency confusion. This happens when developers have multiple versions of the same dependency across different packages in the monorepo.

### Why is this a problem?

Let's say a developer has Zod installed in their monorepo's root, and their Speakeasy SDK also uses Zod. With Speakeasy's bundled Zod dependency, this is no longer an issue since the SDK uses its own version of Zod v3, preventing conflicts with user installations of Zod v4.

Previously, developers might have run into a situation where code like this didn't work:

```typescript
try {
  const result = await sdk.products.create({
    name: "Cool Product",
    price: "not a number", // This should fail validation
  });
} catch (err) {
  if (err instanceof ZodError) {
    // This check could fail with peer dependencies!
    console.log("Validation error:", err.errors);
  }
}
```

The `instanceof` check could fail because they were importing `ZodError` from a different instance of Zod than what the SDK was using. By bundling Zod, Speakeasy eliminates this confusion.

### How to fix it

PNPM's strict module resolution is fantastic at preventing this issue:

```bash