![](/img/trans.png)
[英]Property 'name' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Product> & Readonly<{}>'
[英]React Typescript property does not exist on type / IntrinsicAttributes & IntrinsicClassAttributes
TypeScript的新手,感觉应该很简单,但是我不太满意语法!
非常简单的组件:
import * as React from "react";
import ControlArea from "./ControlArea";
interface IControlAreaProps {
welcome?: any;
}
export class Layout extends React.Component<IControlAreaProps> {
public render() {
return (
<ControlArea welcome="This is the control area"/>
);
}
}
我收到TS错误Property 'welcome' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ControlArea> & Readonly<{ children?: ReactNode; }>...'.
Property 'welcome' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ControlArea> & Readonly<{ children?: ReactNode; }>...'.
朝着正确方向的任何观点将不胜感激。
您在这里的错误是,应将界面添加到Layout组件时将其添加到ControlArea组件
interface IControlAreaProps {
welcome?: any
}
export default class ControlArea extends React.Component<IControlAreaProps> {
// Your ControlArea code
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.