-
Notifications
You must be signed in to change notification settings - Fork 13.3k
TSX error location error with location and JSX commentΒ #63358
Copy link
Copy link
Open
Labels
BugA bug in TypeScriptA bug in TypeScript
Milestone
Description
π Search Terms
TSX JSX error location comments
π Version & Regression Information
- This changed between versions 4.9.5 and 5.0.4.
In TS4 the error was created on the wrapping element instead, which prevents the issue occurring.
β― Playground Link
π» Code
export class Component {
// Error message for {location} is shown on {/* */} instead
// Type 'Location' is not assignable to type 'ReactNode'.(2322)
content = () =>
<div>
{/* */}
{location}
<br />
</div>
// These similar versions are all fine
content2 = () =>
<div>
{/* */}
{x}
<br />
</div>
content3 = () =>
<div>
{location}
<br />
</div>
content4 = () =>
<div>
{/* */}
{location}
</div>
content5 = () =>
<div>
<br />
{location}
{/* */}
</div>
}π Actual behavior
The red squiggly is shown on the {/* */} instead of {location} in the first example.
π Expected behavior
The red squiggly should be shown on {location}.
Additional information about the issue
Just a minor issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript