Narrowed-to-never string-literal union passed to a `never` parameter: SC1090 "'string' values where 'number' is expected"
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #2319 của @ctate — đã merge
Đá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
- 53/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả 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 by tracing how the compiler lowers string-literal unions narrowed to never and compares the resulting argument type with a never parameter. Use the supplied repro with scriptc build repro.ts -o t as the failing case, then compare it with the number-literal union and typeof narrowing examples. Done means the string-literal exhaustiveness example compiles while those comparison cases continue to behave as described.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Disclosure: this report was produced with the help of an AI agent (Claude Code). The agent reduced the problem from a real codebase to the repro below, ran every command shown, and drafted this text; a human reviewed it and decided to file it. The commands and outputs are real runs.
Environment: scriptc 0.4.4 (@scriptc/cli-linux-x64-gnu), Linux x86_64, Node 22.22.0. Reference behaviour from node --experimental-strip-types.
function unreachable(_: never): never { throw new Error("unreachable"); }
type K = "a" | "b";
function f(k: K): number {
if (k === "a") return 1;
if (k === "b") return 2;
return unreachable(k);
}
console.log(f(Date.now() > 0 ? "a" : "b"));
$ scriptc build repro.ts -o t
repro.ts:6:22 - error SC1090: 'string' values where 'number' is expected is not supported yet
$ node --experimental-strip-types repro.ts
1
Expected: compiles (the standard exhaustiveness-check idiom).
Observations (all run 2026-10-24)
unreachable(k as never)fails the same way.- The same program with a number-literal union (
type K = 1 | 2) compiles and prints1. typeof-narrowing astring | numbertonevercompiles and prints1.- So the failure seems specific to a string-literal union narrowed to
never, which appears to be lowered asnumber.
Context: vjuga FunctionUtils.unreachable(_: never): never, used for exhaustive switch/if chains over string-literal unions.
- Ngôn ngữ chính
- TypeScript
- Star
- 6.4k
- Fork
- 204
- Merge trung bình
- 7 giờ 44 phút
- Pull request đã merge (30 ngày)
- 879
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ó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
vercel-labs/scriptc#2845 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Allow storing util.getCallSites without capturing a stackCó thể đã có người làm @jlucaso1 đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
vercel-labs/scriptc#2840 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Register shared JavaScript object globals with unmappable inferred fieldsCó thể đã có người làm @jlucaso1 đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
vercel-labs/scriptc#2837 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hoisted TextEncoder feature probe returns false for encodeIntoCó thể đã có người làm @jlucaso1 đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
vercel-labs/scriptc#2836 ·
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 12/100
vercel-labs/scriptc#2810 ·
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ự
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
🎙️ task - drop the raw `./node_modules/.bin/rhachet roles boot` line from bhuild's feedback templateĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ehmpathy/rhachet-roles-bhuild#639 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
e2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
redhat-developer/rhdh-plugin-export-overlays#4650 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 13 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
omdsh-dev/DSH-better-sidebar#1098 ·
Maintainer thường phản hồi trong vòng 2 ngày