我使用 Angular 6 和 JHipster 5.2.1
\n\n因为它以 html 形式提供:
\n\n<span jhiTranslate="myapp.vehicule.reinitialiser">R\xc3\xa9initialiser</span>\nRun Code Online (Sandbox Code Playgroud)\n\n我想用打字稿来做。
\n\n const btnCancelText = this.jhiTranslateComponent.translateValues("myapp.vehicule.reinitialiser");\nRun Code Online (Sandbox Code Playgroud)\n\n我不知道该怎么做。请问你能帮帮我吗?
\n\n谢谢
\n我想在我的应用程序中使用枚举:
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] …