GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JSX Fragments are in-properly typed with `<></>` syntax, when using `react-jsx` JSX option · Issue #62358 · microsoft/TypeScript

JSX Fragments are in-properly typed with <></> syntax, when using react-jsx JSX option #62358

New issue
Copy link
New issue
Copy link
Open
Open
JSX Fragments are in-properly typed with <></> syntax, when using react-jsx JSX option#62358
Copy link
Assignees
copilot-swe-agent
Labels
BugA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitter
Milestone
Backlog

Description

@guyutongxue
Guyutongxue (guyutongxue)
opened on Aug 30, 2025
Issue body actions

🔎 Search Terms

JSX, Fragment, children type

🕗 Version & Regression Information

Bug exists since TypeScript introduces "jsx": "react-jsx" from version 4.1.2 until next version (6.0.0-dev.20250830).

⏯ Playground Link

https://stackblitz.com/edit/stackblitz-starters-sffhmvvz?file=index.tsx

💻 Code

import { Fragment } from "@/jsx-runtime";

<Fragment>
  {"ok"}
  {({ foo }) => "also ok"}
</Fragment>;

<>
  {"ok"}
  {({ foo }) => "not ok"}
  {/* ^ Binding element 'foo' implicitly has an 'any' type. */}
</>;

With following @/jsx-runtime definition:

export const jsx = (...args: unknown[]) => {};

type JsxElement =
  | JsxElementArray
  | undefined
  | string
  | ((arg: { foo: "bar " }) => void);
interface JsxElementArray extends Array<JsxElement> {}

interface FragmentProps {
  children?: JsxElement;
}

export const Fragment = (props: FragmentProps) => {};

and tsconfig:

{
  "compilerOptions": {
    "strict": true,
    "jsx": "react-jsx",
    "jsxImportSource": "@",
    // [...]
  }
}

🙁 Actual behavior

The first JSX expression using <Fragment> pass the type checking while the second JSX using <> syntax reports error due to it's children was typed to any:

index.tsx:10:7 - error TS7031: Binding element 'foo' implicitly has an 'any' type.

10   {({ foo }) => "not ok"}
         ~~~


Found 1 error in index.tsx:10

🙂 Expected behavior

These two JSX expressions should both pass the type checking.

Additional information about the issue

This issue was first mentioned at #50429 and fixed in #59933, but the fix only take effects on "jsx": "react" not "jsx": "react-jsx", while the latter is a more encouraged approach in a modern project.

Reacted by Arnaud Barré, Nicolas DUBIEN, Nico and Remco Haszing
Reacted by Copilot

Activity

  1. Ryan Cavanaugh (RyanCavanaugh)
    added
    BugA bug in TypeScript
    Help Wanted
    on Sep 2, 2025
  2. Ryan Cavanaugh (RyanCavanaugh)
    added this to the Backlog milestone on Sep 2, 2025
  3. Ryan Cavanaugh (RyanCavanaugh)
    added
    Domain: JSX/TSXRelates to the JSX parser and emitter
    on Oct 15, 2025
  4. Jake Bailey (jakebailey)
    assigned
    Copilot
    on Nov 10, 2025
  5. TypeScript Bot (typescript-bot)
    added
    Fix AvailableA PR has been opened for this issue
    on Nov 10, 2025
  6. Remco Haszing (remcohaszing)
    added a commit that references this issue on Aug 19, 2026

    Import and use explicit Fragment

    5e98aec
  7. Jake Bailey (jakebailey)
    removed
    Fix AvailableA PR has been opened for this issue
    on Aug 20, 2026
  8. Ryan Cavanaugh (RyanCavanaugh)
    removed
    Help Wanted
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • Copilot

Labels

BugA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitter

Type

No type

Projects

No projects

    Milestone

    • BacklogNo due date

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.