Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen
#91 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@BichengWang arbeitet bereits daran.

Seit 10.10.2026.

  • #92 von @BichengWang — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
Ein halber Tag
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
tooling

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
TypeScript
Sterne
272
Forks
55
Ø Merge
12 Std. 18 Min.
Gemergte PRs (30 T.)
5

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus salesforce/agentscript

Alle Issues in salesforce/agentscript

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.