Skip to content

TypeScript ui_framework fires on type assertions (<NamedTypeNode>expr) via the JSX-component alternative #8011

Closed

Description

@squid-protocol

Problem

The TypeScript ui_framework rule is a JSX-component pattern: (?<!\w)<[A-Z]\w+|className=|use(State|Effect|…)|…. In TypeScript, <Foo>expr is an old-style type assertion, so the rule fires on non-UI code. Repro on main 0fddad9:

const x = <E1>node;                      -> ['<E1']
return <NamedTypeNode>factory.create();  -> ['<NamedTypeNode']

On language-crucible TS files, the rule's most frequent matches were <e1, <e2 and <namedtypenode, from compiler code. This inflates arch_ui_framework (1.4% of functions in the v2.12.0 population DB) for compiler and AST code.

Class

  • typescript: affected. .ts cannot contain JSX, so <Upper there is an assertion. .tsx can contain JSX, and is fine if mapped to typescript.
  • javascript: same pattern, but there is no type-assertion syntax, so <Upper is JSX. Not affected.
  • No other language's ui_framework uses the <[A-Z] alternative.

Fix idea

Treat <Upper…> as JSX only when followed by an attribute, />, or a closing tag, or apply it only to .tsx sources. Add rule tests for an assertion, a generic call and a real component. Goldens may move for TS fixtures.

Activity

  1. added
    bug
    core-engine
    priority: low
    scope:sweep
    on Nov 7, 2026
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

    bugcore-enginepriority: lowscope:sweep

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions