Skip to content

P1: TypeScript types broken - .db property not visible #5

@brainkim

Description

@brainkim

Problem

TypeScript cannot see the .db property on Zod schemas:

import { z, table } from "@b9g/zen";

const Users = table("users", {
  id: z.string().db.primary(),  // TS2339: Property 'db' does not exist on type 'ZodString'
});

Runtime works fine because extendZod(z) adds the property dynamically.

Root Cause

The build tool (libuild) is not correctly handling:

  1. .d.ts file paths - references ./impl/table.js which doesn't exist in published package
  2. Module augmentations - declare module "zod" is missing from output

Upstream issue: bikeshaving/libuild#1

Workaround

None currently. Users must use // @ts-ignore or as any casts.

Priority

P1 - Core TypeScript functionality is broken.

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