Skip to content

P1: Module augmentation and .d.ts paths broken in published package #1

@brainkim

Description

@brainkim

Problem

The published package has broken TypeScript types:

  1. .d.ts files reference non-existent paths - The generated zen.d.ts imports from ./impl/table.js, ./impl/database.js, etc., but the impl/ directory doesn't exist in the published package (JS is bundled, but type paths aren't updated).

  2. Module augmentations are missing - The declare module "zod" augmentation in source files is not included in the published types.

Evidence

Published zen.d.ts:

export { table, ... } from "./impl/table.js";  // This path doesn't exist

Published directory structure:

dist/src/
├── zen.d.ts      # references ./impl/*.js
├── zen.js        # bundled, works fine
└── (no impl/ directory)

Source has module augmentation that's missing from output:

// src/impl/table.ts
declare module "zod" {
  interface ZodType<out Output, out Input, out Internals> {
    readonly db: ZodDBMethods<this>;
  }
}

Impact

  • TypeScript users get errors like Property 'db' does not exist on type 'ZodNumber'
  • Runtime works fine (extendZod() adds properties dynamically)
  • Types are completely broken for consumers

Expected Behavior

Either:

  1. Roll up all .d.ts into a single bundled declaration file with correct paths
  2. Or preserve the impl/ directory structure for type files
  3. And ensure declare module augmentations are included in output

Workaround

Currently none - consumers must use // @ts-ignore or skip type checking for zen imports.

Priority

P1 - Package is unusable for TypeScript users despite being a TypeScript-first library.

Metadata

Metadata

Assignees

No one assigned

    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