【发布时间】:2019-06-21 12:05:29
【问题描述】:
我有一个可在整个应用程序中使用的可重用输入组件
import * as React from 'react';
import styles from "./Input.module.css";
interface Props {
input: Object;
label: string;
custom: Object;
meta: {
touched: boolean;
error: boolean;
}
}
const Input: React.SFC<Props> = ({
input,
label,
custom,
}) => (
<div className={styles.container}>
<input {...input} {...custom} />
<span className={styles.highlight} />
<span className={styles.bar} />
<label>{label}</label>
</div>
);
export default Input;
我正在将一个旧的 javascript 项目从 javascript 转换为 typescript。一切正常,除了当我将道具传播到输入标签中时,打字稿返回此错误。
知道是什么导致了错误吗?
【问题讨论】:
标签: reactjs typescript jsx spread-syntax