Assigning a wide Node object (process.stdout) to a narrow { write } record fails SC2002 (width-copy rules)
Maintainer thường phản hồi trong vòng 1 ngày
@espetro đang làm issue này rồi.
Từ ngày 4/11/2026.
Đá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
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
- Lĩnh vực
- compilers
Hướng nghiên cứu
Start from the SC2002 diagnostic and the record-shape flow check that emits it, then reproduce with the minimal case: const sink: Sink = process.stdout where Sink is { write(s: string): void }. The open question is whether width-copy should accept this direction or whether the subset should document the wrapper adapter as the blessed pattern. Done means a maintainer-chosen behavior, with either a passing test for the accepted case or a docs entry for the adapter.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Assigning process.stdout (a WriteStream) to a parameter/interface typed as a minimal { write(str: string): void } record fails with SC2002 "record shape flow outside the width-copy rules". The concrete Node type has many more members than the target record; the subset's record-flow rules refuse the width mismatch rather than copying the needed member.
Actual (scriptc 0.4.7)
interface Sink { write(s: string): void }
const sink: Sink = process.stdout; // SC2002
(Exact repro program available; compiled with scriptc build / compile() so the IR validator runs.)
Expected
Either:
- structural acceptance when the target record's members are all present on the source type (width-copy in the safe direction), or
- a documented seam: e.g. wrap the wide Node object in a narrow adapter (
const sink: Sink = { write: (s) => process.stdout.write(s) }), if that is the blessed pattern it would help to say so in the subset docs.
Downstream evidence
T3 Code's ACP MCP stdio fast path wants to hand process.stdout to a helper typed as a minimal writer (AcpMcpStdioBridge.ts output: process.stdout). The wrapper workaround is cheap for us, so this is quality-of-life for the subset's ergonomics, not a blocker once we know the blessed shape.
- Ngôn ngữ chính
- TypeScript
- Star
- 6.5k
- Fork
- 212
- Merge trung bình
- 13 giờ 46 phút
- Pull request đã merge (30 ngày)
- 787
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của vercel-labs/scriptc
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 54/100
vercel-labs/scriptc#3534 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 46/100
vercel-labs/scriptc#3533 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
vercel-labs/scriptc#3532 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
vercel-labs/scriptc#3531 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 53/100
vercel-labs/scriptc#3530 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của vercel-labs/scriptc
Issue tương tự
-
bug from-app needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nightly-labs/openbot#7447 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Team:ResponseOps technical debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
elastic/kibana#304569 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
IBM/ibmi-mcp-server#256 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
egonSchiele/agency-lang#1444 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[fullsend] E2E: backstage-gitlab-events-org — socket hang up during catalog poll needs retriesĐang mởe2e-failure ready-to-code
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
redhat-developer/rhdh-plugin-export-overlays#4746 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày