Based on Matt Raible's article, I create an application with the same JHipster options other than authentication type and development database. With his JH entity file, I get the following errors
error in /home/me/workspace/gallery/src/main/webapp/app/entities/album/album-delete-dialog.tsx
ERROR in /home/me/workspace/gallery/src/main/webapp/app/entities/album/album-delete-dialog.tsx(12,97):
TS2344: Type '{ id: number; }' does not satisfy the constraint '{ id?: string; }'.
Types of property 'id' are incompatible.
Type 'number' is not assignable to type 'string'.
It seems to me that there is an error in JHipster. I use the latest version, 5.2.1.
答案 0 :(得分:2)
这是一个不依赖于固定版本的节点依赖项引入的重大更改(@types/react-router
的新版本要求使用字符串而不是数字)。 JHipster的最新版本已修复此问题。
要在您的项目中解决它,请升级generator-jhipster
并重新生成您的实体。如果您希望手动修复它,请修复所有扩展RouteComponentProps
的React组件,以对string
使用id
道具,例如in this commit