Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

High TypeScript checking cost from generated Zod 3 schemas

Đang mở
#2,624 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
22/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
nodejs, typescript
Lĩnh vực
performance

Hướng nghiên cứu

Start with the reproduction: a one-line import of LazyValue and TestBackgroundLogger from braintrust, checked with yarn exec tsc --extendedDiagnostics under the given tsconfig, compared against an export {} baseline. The generated schemas live in js/src/generated_types.ts, which imports zod/v3. Done means a measured drop in type and instantiation counts while the public input and output types stay the same. The issue asks for that benchmark before any migration.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Braintrust 3.37.2 adds substantial declaration-checking work from a single unused import.

Reproduction

Use Node.js 24.21.0 and an ESM project ("type": "module" in package.json). With Yarn, set nodeLinker: node-modules in .yarnrc.yml.

yarn add [email protected] [email protected]
yarn add -D [email protected] @types/[email protected] [email protected]

repro.ts:

import { LazyValue, TestBackgroundLogger } from "braintrust";

tsconfig.json:

{
  "compilerOptions": {
    "strict": true,
    "target": "ES2023",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "types": ["node"],
    "skipLibCheck": false,
    "noEmit": true
  },
  "files": ["repro.ts"]
}

Run yarn exec tsc --extendedDiagnostics. For the baseline, replace the import with export {};.

Results

All checks pass. Measured deterministic counts on TS7:

Case Types Instantiations
No Braintrust import 64,716 62,345
With Braintrust import 624,895 1,791,353

No SDK calls or credentials are required. The root and braintrust/node imports load the same declarations.

Possible fix

Generated schemas import zod/v3. Zod 4 redesigned its generics to reduce compiler instantiations.

Could these schemas migrate to Zod 4 and the public declarations be regenerated? That seems like the first approach to benchmark, while preserving precise public input and output types. We have not measured an actual schema migration yet.

Ngôn ngữ chính
TypeScript
Star
29
Fork
16
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
70

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của braintrustdata/braintrust-sdk-javascript

Tất cả issue của braintrustdata/braintrust-sdk-javascript

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.