Skip to content

Type definitions from @repo/shared are not accessible to consumers #165

@moneydance

Description

@moneydance

Type definitions from @repo/shared are not accessible to consumers

Description

The @cloudflare/sandbox package re-exports type definitions from @repo/shared, but this package is not available to consumers because it's listed as a devDependency rather than a regular dependency, and it's not published to npm.

Current Behavior

In dist/index.d.ts:

export * from '@repo/shared';
export { BaseExecOptions, ExecEvent, ExecOptions, ExecResult, FileChunk, FileMetadata, FileStreamEvent, GitCheckoutResult, ISandbox, LogEvent, PortCloseResult, PortExposeResult, PortListResult, Process, ProcessCleanupResult, ProcessInfoResult, ProcessKillResult, ProcessListResult, ProcessLogsResult, ProcessOptions, ProcessStartResult, ProcessStatus, StartProcessRequest, StreamOptions, isExecResult, isProcess, isProcessStatus } from '@repo/shared';

In package.json:

{
  "devDependencies": {
    "@repo/shared": "^0.0.0"
  }
}

Impact

When consuming the @cloudflare/sandbox package, TypeScript cannot resolve these re-exported types because @repo/shared is:

  1. Not installed (it's a devDependency)
  2. Not published to npm (it's an internal monorepo package)

This results in:

  • Loss of type safety for methods like listFiles() which return types from @repo/shared (e.g., ListFilesResult)
  • Consumers must use any types or manually recreate the type definitions
  • TypeScript errors when trying to import re-exported types

Steps to Reproduce

  1. Install @cloudflare/sandbox in a project
  2. Try to use types from the package:
    import { Sandbox, ListFilesResult } from '@cloudflare/sandbox';
    
    const sandbox: Sandbox;
    const files: ListFilesResult = await sandbox.listFiles('/');
  3. TypeScript will fail to resolve ListFilesResult and related types

Expected Behavior

All type definitions should be accessible to consumers of the package without requiring unpublished dependencies.

Environment

  • @cloudflare/sandbox version: 0.4.11
  • TypeScript version: 5.x
  • Package manager: pnpm/npm/yarn

Workaround

Currently, consumers must manually define the types locally:

interface FileInfo {
  path: string;
  name: string;
  isDirectory: boolean;
  size?: number;
  modifiedAt?: number;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions