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

pre-push blocks pushes on a typecheck error in unmodified src/bus/global.ts

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

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
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bun, git, node.js, typescript

Hướng nghiên cứu

Bắt đầu với packages/opencode/src/bus/global.ts và cấu hình pre-push của repository, sau đó chạy bun typecheck từ một bản cài đặt sạch trong khi ghi lại các phiên bản TypeScript và @types/node đã được phân giải. So sánh các môi trường bị ảnh hưởng và sạch để tách biệt lỗi override khỏi sai lệch khi cài đặt. Hoàn tất nghĩa là typecheck pre-push đáng tin cậy đối với các contributor sử dụng toolchain đã được khóa, mà không cần --no-verify.

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

Mô tả

What happens

git push is blocked by the pre-push hook because bun typecheck fails on code the contributor did not touch — packages/opencode/src/bus/global.ts:14, which is unmodified on origin/main:

Type 'any[]' is not assignable to type '[event: GlobalEvent]'.
  Target requires 1 element(s) but source may have fewer.

14   override emit(eventName: "event", event: GlobalEvent): boolean {
                   ~~~~~~~~~

Found 1 error in src/bus/global.ts:14

Failed:    @altimateai/altimate-code#typecheck
 ERROR  run failed: command  exited (2)
error: "turbo" exited with code 2
husky - pre-push script failed (code 2)
error: failed to push some refs to 'https://github.com/AltimateAI/altimate-code.git'
The code
class GlobalBusEmitter extends EventEmitter<{
  event: [GlobalEvent]
}> {
  override emit(eventName: "event", event: GlobalEvent): boolean {

With the generic EventEmitter<T> form, the base declares emit across a set of overloads including (eventName: string | symbol, ...args: any[]). An override has to be assignable to all of them, and this narrow one-event signature is not — hence any[] not assignable to [event: GlobalEvent].

Why it matters

The hook is the only pre-push gate in the repo, and this failure is indistinguishable from a real error introduced by the contributor. The natural workaround is git push --no-verify, which disables the gate entirely for that push. Anyone who hits it once tends to keep using it.

Important caveat: not universally reproducible

I could not reproduce it. On a clean worktree at origin/main:

bun typecheck 13 tasks successful, 0 errors
@types/node 24.12.2 (matches the catalog: pin)
typescript 7.29.7
@typescript/native-preview 7.0.0-dev.20251207.1
bun 1.3.14

Same pinned @types/node as the catalog specifies, and global.ts typechecks clean. So this is toolchain- or install-dependent, not a straightforward break on main — which also fits main's CI, where the TypeScript job passes.

That makes the version skew itself part of the bug: two contributors on the same commit get different answers from the same command, and the one who gets the error has no way to tell it apart from a real one.

Suggested direction

Two things worth separating:

  1. Make the override version-robust so it satisfies the base overload set regardless of which @types/node resolves — either by widening the override to the generic signature, or by dropping the emit override in favour of a named method (e.g. publish(event)) that stamps the id and delegates to super.emit("event", event).
  2. Work out why the resolved toolchain differs between machines on the same lockfile, since a non-deterministic typecheck undermines the hook whatever global.ts looks like.

Reproduction details from an affected machine (resolved @types/node, @typescript/native-preview, and whether node_modules predates the current lockfile) would pin down which of the two is doing the damage.

Unrelated, noticed while looking

There is no .husky/pre-commit. core.hooksPath is .husky/_, whose generated pre-commit shim exits 0 when no .husky/pre-commit exists, so commits currently run no checks at all. Flagging in case that is unintentional — happy to split it out.

Ngôn ngữ chính
TypeScript
Star
813
Fork
134
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
65

Hướng dẫn đóng góp

Mở 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 AltimateAI/altimate-code

Tất cả issue của AltimateAI/altimate-code

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.