3

While trying to render a custom HTML tag <my-element> in JSX an error displayed Property does not exist on type 'JSX.IntrinsicElements'

I've found some examples of how to do that using

declare global {
  interface IntrinsicElements {
    "my-element": any
  }
}

but this produced another error:

ES2015 module syntax is preferred over custom TypeScript modules and namespaces @typescript-eslint/no-namespace

1 Answer 1

4

I've found the useful link to Typescript guide which helped me a lot:

The main idea is to create a new file with extension d.ts (e.g. myModule.d.ts) which should contain the following

export as namespace JSX;

export interface IntrinsicElements {
  "my-element": any;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.