typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

In mono repo, tsgo not picking types from custom packages

Open Hemantvetal opened this issue 2 weeks ago • 2 comments

Type: Bug

In mone repo, services are not able to compile types from packages

Extension version: 0.20251210.1 VS Code version: Code 1.107.0 (618725e67565b290ba4da6fe2d29f8fa1d4e3622, 2025-12-10T07:43:47.883Z) OS version: Windows_NT x64 10.0.19045 Modes: Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2

Image
System Info
Item Value
CPUs Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz (8 x 2112)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.77GB (17.81GB free)
Process Argv
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-20.04
OS Linux x64 6.6.87.2-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz (8 x 0)
Memory (System) 15.50GB (13.49GB free)
VM 0%

Hemantvetal avatar Dec 11 '25 06:12 Hemantvetal

This isn't enough information; do you have a repo you can share?

jakebailey avatar Dec 11 '25 07:12 jakebailey

Hello, Since I'm running into this on a private repository, I can provide the steps to set up a minimal project that demonstrates the issue.

🛠️ Minimal Reproduction Steps The core issue appears when using a pnpm-based monorepo configuration:

Initialize a pnpm workspace (monorepo):

Bash

pnpm init -w Create a simple TypeScript package:

Create a directory for the package (e.g., packages/example-package).

Add a package.json and a simple type file (e.g., src/index.ts) that exports a type:

TypeScript

// packages/example-package/src/index.ts export type SimpleType = { id: number; name: string; }; Create a service/application:

Create a directory for the service (e.g., apps/service).

Add a package.json that includes example-package as a dependency:

JSON

// apps/service/package.json (excerpt) "dependencies": { "@example/package": "workspace:*" } Install dependencies and try to use the type:

Run pnpm install at the monorepo root.

In the service, try to import and use the type:

TypeScript

// apps/service/src/main.ts import type { SimpleType } from '@example/package'; // ⬅️ This is where the error occurs

const myData: SimpleType = { id: 1, name: 'Test' }; // ... 🛑 The Error When trying to compile or run the service, the following TypeScript error is thrown for the import statement:

Cannot find module '@example/package' or its corresponding type declarations ts(2307)

This suggests the service cannot correctly resolve the types exported by the local package within the pnpm monorepo structure.

Hemantvetal avatar Dec 11 '25 07:12 Hemantvetal