Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#91 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@BichengWang 已经在做这个了。

开始于 2026年10月10日。

  • #92 来自 @BichengWang —— 未关闭

评估

难度
3/5
预计耗时
半天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
tooling

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
272
派生
56
平均合并
12 小时 18 分钟
30 天内合并 PR
5

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

salesforce/agentscript 的其他 Issue

查看 salesforce/agentscript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。