Skip to content

TypeScript/TSX: two false-positive "syntax errors" warnings — & in a JSX string attribute, and a member named in_* relying on ASI #2599

Closed

Description

@atlasplatformu-ai

graphify 0.9.39, Python 3.11.9, Windows, tree-sitter-typescript 0.23.2.

graphify extract . --code-only on a ~1400-file repo reports:

warning: 2 file(s) had syntax errors and may be partially extracted:
  SomePage.tsx (first error at line 276), types.ts (first error at line 1242) (#2551)

Both files are valid TypeScript — tsc -b on the project exits 0. I reduced them to two independent minimal cases. Each is accepted by tsc and rejected by the bundled tree-sitter grammar, so I believe both are false positives.

1. & inside a JSX string attribute (tsx grammar)

declare const Comp: (p: { to: string }) => JSX.Element
export const el = <Comp to="/p?a=1&b=2" />

The ERROR node covers exactly &b=2. These parse fine:

  • without the ampersand — to="/p?a=1"
  • with the string in braces — to={"/p?a=1&b=2"}
  • as a plain (non-JSX) string — const s = "/p?a=1&b=2"

Query-string URLs in to= / href= attributes are common in router-heavy code, so a single link can cost the whole file's nodes.

2. Member named in_* / instanceof_* relying on ASI (typescript grammar)

interface I {
  a: number
  in_workshop: number
}

The ERROR node spans from number to in_workshop:. It fires only when the previous member ends without ; or ,, and the member name begins with in or instanceof followed by a non-letter:

member name result
in_workshop, in_x, in_, in2_x, instanceof_x ERROR
inx, input, index, int_count, infer_x, instanceofx ok

Adding ; to the previous member avoids it, as does moving the member to first position. The keyword-boundary check for in / instanceof seems to treat _ and digits as token terminators, though both are valid identifier-continuation characters. Names like in_workshop, in_progress, in_stock are common when types mirror snake_case API or DB fields, and semicolon-less interface members are the Prettier default.

Verification

  • tsc --noEmit --strict on case 2 → exit 0
  • tsc --noEmit --jsx preserve --skipLibCheck on case 1 → exit 0
  • Parsing each snippet directly with tree_sitter_typescript.language_typescript() / language_tsx() (fresh Parser per snippet) yields exactly one ERROR node, so this looks like it is upstream in the grammar rather than in graphify's extractor. Filing here since graphify pins the grammar range (>=0.23,<0.25) and surfaces the warning.

Impact

The warning itself is honest about the risk, and it is what led me to find a real bug elsewhere in my repo, so thank you for emitting it. But for these two files the extraction loss is silent and unnecessary: they are well-formed TypeScript.

Activity

  1. added 2 commits that reference this issue on Aug 11, 2026
  2. safishamsi commented on Aug 11, 2026

    @safishamsi
    Member

    Fixed in v0.9.40 (graphifyy==0.9.40 on PyPI) — same fix as #2610. The &-in-JSX-attribute and in_* interface-member cases are single-line fully-recovered errors that extract completely, so they no longer trip the warning. Thanks for the precise snippets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions