Skip to content

Fix published package type exports for external consumers #25

Description

@ezocomp118-source

Problem

@prover-coder-ai/openapi-effect@1.0.22 is hard to consume from another strict TypeScript workspace because the package exports TypeScript source files as its public types:

"exports": {
  ".": {
    "types": "./src/index.ts",
    "import": "./dist/index.js"
  }
}

When docker-git tried to replace openapi-fetch with @prover-coder-ai/openapi-effect, consumer tsc --noEmit resolved the package type surface through src/index.ts and then pulled in internal source modules that are not valid for external consumers.

Observed failures included:

src/generated/dispatch.ts: Cannot find module '../../tests/fixtures/petstore.openapi.js'
src/generated/dispatchers-by-path.ts: Cannot find module '../../tests/fixtures/petstore.openapi.js'
src/shell/api-client/create-client-runtime-helpers.ts: Cannot find name 'process'

The published source type graph also imports openapi-typescript-helpers, but the package metadata does not declare it as a dependency. That means consumers can fail unless they happen to install the helper package themselves.

Repro

In a strict external workspace:

import { createClientEffect } from "@prover-coder-ai/openapi-effect"

type paths = {
  "/health": {
    get: {
      responses: {
        200: {
          content: {
            "application/json": { ok: boolean }
          }
        }
      }
    }
  }
}

const client = createClientEffect<paths>()
client.GET("/health")

Run:

tsc --noEmit

Expected

External consumers should be able to import the public API without local paths shims or ambient module declarations.

Suggested fix

  • Emit declaration files during package build.
  • Change package exports from ./src/index.ts to generated ./dist/index.d.ts or equivalent public declaration output.
  • Ensure published declaration files do not reference test fixtures or generated sample dispatchers.
  • Declare openapi-typescript-helpers if it is part of the public type surface, or avoid leaking it to consumers.
  • Add a consumer fixture/test that installs the packed package into a separate strict TypeScript project and runs tsc --noEmit.

Downstream impact

docker-git PR ProverCoderAI/docker-git#431 currently needs a local packages/openapi/src/types/openapi-effect.d.ts facade only because the published package type surface is not consumable directly. Once this is fixed upstream, that local facade and the related tsconfig paths mapping should be removed from docker-git.

Proof obligation

A fix is complete when a fresh consumer workspace can install @prover-coder-ai/openapi-effect, import createClientEffect, and pass tsc --noEmit without any local module declaration override.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions