We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsx tag namespace
v4.5.4, v4.6.0-dev.20211221
Playground link with relevant code
import React from "react"; function MyComponent() { return <svg : path />; }
TypeScript reports errors:
Type 'true' is not assignable to type 'string | undefined'. Identifier expected.
TypeScript compiler generates undesired JavaScript:
import React from "react"; function MyComponent() { return React.createElement("svg", { path: true }); }
It looks like TypeScript is interpreting svg : path similar to svg path. According to the JSX specification, whitespace is allowed around the : token.
svg : path
svg path
:
TypeScript treats the code as if it was the following:
import React from "react"; function MyComponent() { return <svg:path />; // Note: no spaces around ':'. }
generating the following JavaScript:
import React from "react"; function MyComponent() { return React.createElement("svg:path", null); }
Babel, ESLint, and Flow interpret the code this way. ESBuild seems to have the same interpretation as TypeScript.
The text was updated successfully, but these errors were encountered:
We should parse this better, but namespaced elements are not yet supported. See also #7411
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Bug Report
π Search Terms
jsx tag namespace
π Version & Regression Information
v4.5.4, v4.6.0-dev.20211221
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
TypeScript reports errors:
TypeScript compiler generates undesired JavaScript:
It looks like TypeScript is interpreting
svg : path
similar tosvg path
. According to the JSX specification, whitespace is allowed around the:
token.π Expected behavior
TypeScript treats the code as if it was the following:
generating the following JavaScript:
Babel, ESLint, and Flow interpret the code this way. ESBuild seems to have the same interpretation as TypeScript.
The text was updated successfully, but these errors were encountered: