Two TS linting errors in `main.ts`
維護者通常 1 天內回覆
評估
- 難度
- 1/5
- 預估耗時
- 1 小時以內
- 新手友好度
- 45/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
Find the ng new workspace template that emits src/main.ts (the angular-cli schematics workspace files, ending in .ts.template) and update the .catch callback to the block-bodied err: unknown form shown in the issue. Verify by generating a project with ng new, adding @angular-eslint/schematics, switching to tseslint.configs.strictTypeChecked with typed linting parser options, and running ng lint — done means both rules pass. Note an open pull request (#34268) already targets this issue, so check its status before starting.
由索引模型根據 Issue 內容生成。
描述
Command
new
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
ng new generates boilerplate that contains two linting errors. They appear when linting with type information:
<path>\src\main.ts
6:11 error Prefer the safe `: unknown` for a `catch` callback variable @typescript-eslint/use-unknown-in-catch-callback-variable
6:19 error Returning a void expression from an arrow function shorthand is forbidden. Please add braces to the arrow function @typescript-eslint/no-confusing-void-expression
The two issues can be fixed by changing the offending code to:
bootstrapApplication(App, appConfig).catch((err: unknown) => {
console.error(err);
});
See the ts-eslint doc pages for no-confusing-void-expression and use-unknown-in-catch-callback-variable.
Minimal Reproduction
- Generate a new project with
ng new. - Run
ng add @angular-eslint/schematicsto add eslint. In eslint.config.js, changetseslintConfigs.recommendedtotseslint.configs.strictTypeChecked.- Add
languageOptions.parserOptionsas described in thets-eslintdocs. - Run
ng lint.
Exception or Error
Your Environment
Angular CLI : 22.0.1
Angular : 22.0.1
Node.js : 26.9.0
Package Manager : npm 11.16.0
Operating System : win32 x64
Anything else relevant?
TS 7.1 is expected to bring a faster typed linting API, so typed linting will become even more common.
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 1 天 2 分鐘
- 30 天內合併 PR
- 168
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
angular/angular-cli 的其他 Issue
-
area: @angular/build gemini-triaged
難度 2/5 1-3 小時 新手友好度 74/100
angular/angular-cli#33955 ·
維護者通常 1 天內回覆
-
area: @angular/cli gemini-triaged
難度 2/5 1-3 小時 新手友好度 72/100
angular/angular-cli#33055 · 1 則留言 · 3 個 reaction ·
維護者通常 1 天內回覆
-
dev-server: es2016 prebundle target for zone.js apps lowers private fields and breaks dependencies未關閉area: @angular/build
難度 4/5 3-5 天 新手友好度 48/100
angular/angular-cli#34280 ·
維護者通常 1 天內回覆
-
area: @angular/build
難度 4/5 3-5 天 新手友好度 48/100
angular/angular-cli#34262 ·
維護者通常 1 天內回覆
-
Vite dev server: proxy config normalization reorders glob keys, drops string `context` and misses URLs with a query string可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉area: @angular/build
難度 4/5 3-5 天 新手友好度 65/100
angular/angular-cli#34257 ·
維護者通常 1 天內回覆
查看 angular/angular-cli 的全部 Issue
相似的 Issue
-
bug priority:low ready-for-dev
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
Automattic/data-liberation-agent#685 ·
維護者通常 1 天內回覆
-
Business
難度 2/5 1-3 小時 新手友好度 66/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 83/100
txn2/mcp-data-platform#2063 ·
維護者通常 1 天內回覆
-
bug
難度 1/5 1 小時以內 新手友好度 77/100
Crosstalk-Solutions/project-nomad#1427 ·
維護者通常 2 天內回覆