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

[Bug] List type parameters silently accept non-type expressions

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

@BichengWang đang làm issue này rồi.

Từ ngày 10/10/2026.

  • #92 của @BichengWang — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa 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ệ
typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Start in the TypedMapParser.validateSubscriptType function, which currently handles only identifier and nested-subscript arguments, and see how it dispatches on argument shape. Add an Error diagnostic of kind invalid-type-parameter for literal, reference and expression arguments inside list brackets, pointing at the argument. Done when the five declarations in the reproduction yield Error diagnostics and the real-schema regression tests pass, while supported primitives and the unknown-type and nested-list-type controls still behave as before.

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

Mô tả

Description

List declarations accept literals and other expressions as their element type without an error. The documented list syntax requires a supported type, such as list[string], but TypedMapParser.validateSubscriptType only handles identifier and nested-subscript arguments. Other argument shapes fall through validation.

Steps to Reproduce

  1. Use the source checkout at 16396089a4264b544d40d4aaf83c1f8aa981760c with the standard AgentScript schema and default lint rules.
  2. Parse each declaration in the reproduction below.
  3. Inspect the parse and lint diagnostics.

Expected Behavior

Each non-type argument produces an Error diagnostic pointing to the argument inside the brackets. Supported primitive identifiers remain accepted.

Actual Behavior

All five declarations parse without syntax errors and receive no type Error. The default lint engine reports only an unused-variable warning for an isolated declaration. Controls correctly reject list[missing] as unknown-type and list[list[string]] as nested-list-type.

Environment

  • Node.js: 22.20.0
  • pnpm: 10.28.0
  • OS: macOS 27.0.1, arm64
  • Package: source build of @agentscript/language 3.2.3 and @agentscript/agentscript-dialect 3.4.0

Minimal Reproduction

variables:
    number_parameter: mutable list[1]
    boolean_parameter: mutable list[True]
    string_parameter: mutable list["string"]
    reference_parameter: mutable list[@variables.other]
    expression_parameter: mutable list[string + number]

Additional Context

Real-schema regression tests for these five forms fail against unchanged code because the Error diagnostic array is empty. All 12 supported element types and the two negative controls pass in the same run: 5 failed, 14 passed. The change can reuse invalid-type-parameter for the previously unhandled argument shapes.

Ngôn ngữ chính
TypeScript
Star
272
Fork
56
Merge trung bình
12 giờ 18 phút
Pull request đã merge (30 ngày)
5

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 salesforce/agentscript

Tất cả issue của salesforce/agentscript

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.