由于代码冗余原因,我将我的实体的PropTypes放在单独的文件中,如:
从' prop-types';
导入PropTypesdocument.parentWindow.frames("FrameA").document.all.tags("a")[18].click()
它运行良好但是当我以这种方式定义PropType并将其导入组件并使用它时:
export const costCenterBookingPropTypes = PropTypes.shape({
errorState: PropTypes.bool,
costCenter: PropTypes.string,
customerName: PropTypes.string,
zipCode: PropTypes.number.isRequired,
city: PropTypes.string,
startTime: PropTypes.string,
endTime: PropTypes.string,
drivingTimeActive: PropTypes.string,
drivingTimePassive: PropTypes.string,
breakTime: PropTypes.string,
loadingTime: PropTypes.string,
workingTime: PropTypes.string
});
然后我的错误状态,zipCode等道具没有智能感知/自动完成功能。
这是一个已知问题还是我犯了错误?如果这很重要,我将使用WebStorm作为IDE。
答案 0 :(得分:1)
您描述的行为只能通过TypeScript实现,并且您必须执行一些(非常繁重的)代码重构。