小编Man*_*wan的帖子

在打字稿文件中使用 Jhi Translate

我使用 Angular 6 和 JHipster 5.2.1

\n\n

因为它以 html 形式提供:

\n\n
<span jhiTranslate="myapp.vehicule.reinitialiser">R\xc3\xa9initialiser</span>\n
Run Code Online (Sandbox Code Playgroud)\n\n

我想用打字稿来做。

\n\n
 const btnCancelText = this.jhiTranslateComponent.translateValues("myapp.vehicule.reinitialiser");\n
Run Code Online (Sandbox Code Playgroud)\n\n

我不知道该怎么做。请问你能帮帮我吗?

\n\n

谢谢

\n

jhipster angular

4
推荐指数
1
解决办法
1543
查看次数

在 JHipster 应用程序中声明任何 TypeScript 枚举时无阴影误报

我想在我的应用程序中使用枚举:

export const enum typeEnum {
  TVY = 'TVY',

  USER = 'USER',
}
Run Code Online (Sandbox Code Playgroud)

在 npm run webpack:build 中,我收到以下错误:

12:111 错误 'typeEnum' 已经在上层作用域 no-shadow 中声明

我阅读了几个与此错误相关的链接,解决方案是将以下内容添加到 eslint 规则中:

  "no-shadow": "off",
  "@typescript-eslint/no-shadow": "error"
Run Code Online (Sandbox Code Playgroud)

这就是我在 .eslintrc.json 文件中所做的:

{
  "plugins": ["@typescript-eslint/tslint"],
  "extends": ["jhipster"],
  "parserOptions": {
    "project": "./tsconfig.base.json"
  },
  "rules": {
    "@typescript-eslint/tslint/config": [
      "error",
      {
        "lintFile": "./tslint.json"
      }
    ],
    "@typescript-eslint/no-unused-vars": [
      "warn",
      {
        "vars": "all",
        "args": "after-used",
        "ignoreRestSiblings": false
      }
    ],
    "@typescript-eslint/no-non-null-assertion": "off",
    "no-shadow": "off",
    "@typescript-eslint/no-shadow": "error"
  }
}
Run Code Online (Sandbox Code Playgroud)

但是现在,我也在 npm run:webpack:build 上收到此错误:

myPath\src\main\webapp\app\vendor.ts [INFO] …

typescript eslint jhipster

1
推荐指数
2
解决办法
2454
查看次数

标签 统计

jhipster ×2

angular ×1

eslint ×1

typescript ×1