当我在组件内部使用扩展运算符时,eslint道具类型不会给我任何错误;
示例:
`
const { status } = props //status not have an error
let customProps = null;
if (status === 1) customProps = { style: { flex: 0.2 } };
else if (status === 2) customProps = { style: { flex: 0.4 } };
if (!customProps) return null;
return (
<View {...customProps}>
</View>
);
`
`
const { status } = props //status have an error
let customProps = null;
if (status === 1) customProps = { style: { flex: 0.2 } };
else if (status === 2) customProps = { style: { flex: 0.4 } };
if (!customProps) return null;
return (
<View>
</View>
);
`