Skip to content

Using reserved words as intrinsic elements in TSX #48657

@erikbrinkman

Description

@erikbrinkman

Bug Report

Using a reserved word as the name of an intrinsic element triggers the error Identifier expected. '<word>' is a reserved word in strict mode.. This is similar to #17452.

I'm happy to submit a PR, but I am not familiar with this path, so I'd need guidance on where to look / what to consider.

🔎 Search Terms

reserved word intrinsic elements tsx

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________

⏯ Playground Link

Playground link with relevant code

💻 Code

declare const React: any;

declare module JSX {
    interface IntrinsicElements {
        ["package"]: any;
    }
}

function Xml() {
    return <package />;
}

🙁 Actual behavior

error thrown

🙂 Expected behavior

no error since ultimately intrinsic elements become static strings or stay in jsx format

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions