Skip to content

Re-enable tsup dts for @davstack/* packages #32

@DawidWraga

Description

@DawidWraga

After the ship-compiled-dist change (PR to come), all five @davstack/* packages compile JS via tsup but ship no .d.tsdts: true was disabled because dts generation runs a full typecheck and the existing source has unresolved type errors.

Why blocked

packages/cli-utils/src/cli.ts surfaces these on dts:

  • Property 'error' does not exist on type '{ ok: true; value: FlagValue }' — discriminated-union narrowing not threading through to several call sites (lines 171, 188, 208, 260).
  • Cannot find name 'process' (lines 203, 204) — @types/node not installed at any level.
  • Dynamic imports are only supported when 'module' is es2020/esnext/nodenext/etc + An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled (lines 259, 265, 271) — bun-style await import("./foo.ts") with explicit extension.

These cascade into vitest-server / playwright-server / logs-server / open-agents (all depend on cli-utils types).

Fix plan

  1. Add @types/node at workspace root.
  2. Add a tooling/typescript/node-esm.json preset: module: esnext, moduleResolution: bundler, allowImportingTsExtensions: true, noEmit: true, target: es2022, strict: true.
  3. Per-package tsconfig.json extending that preset.
  4. Fix the .error narrowing in cli.ts (likely a missing if (!result.ok) guard before reading .error).
  5. Flip dts: falsedts: true in every tsup.config.ts and restore the "types" conditions in each package.json exports block.

Acceptance

  • pnpm exec turbo run build passes including dts for all 5 packages.
  • Tarballs contain dist/*.d.ts next to dist/*.js.
  • A consumer's tsc resolves @davstack/vitest-server/config etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions