interface IntrinsicElements {
// HTML
a: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
abbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
address: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
area: React.DetailedHTMLProps<React.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
article: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
...
}
Basicly it define the HTML component you can use in React, and it's attirubutes;
So, if you have a component
<myNewElement foo="123" />;
You can also add into it:
declare global {
namespace JSX {
interface IntrinsicElements {
myNewElement: {foo: string}
}
}
}
标签:IntrinsicElements,HTML,React,DetailedHTMLProps,Typescript,HTMLElement,JSX From: https://www.cnblogs.com/Answer1215/p/17651432.html