Two TS linting errors in `main.ts`
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 1/5
- Temps estimé
- Moins d'une heure
- Accessibilité débutants
- 45/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
- Domaine
- developer-experience
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 1 j 46 min
- PR mergées (30 j)
- 160
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de angular/angular-cli
-
area: @angular/cli
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
angular/angular-cli#34263 ·
Les mainteneurs répondent en général sous 1 jour
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-serverOuvertearea: @angular/build gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
angular/angular-cli#33955 ·
Les mainteneurs répondent en général sous 1 jour
-
area: @angular/cli gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
angular/angular-cli#33055 · 1 commentaire · 3 réactions ·
Les mainteneurs répondent en général sous 1 jour
-
Follow-up to issue: SSR: Add a way to configure externalDependencies for the server bundle onlyOuvertearea: @angular/build
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
angular/angular-cli#34262 ·
Les mainteneurs répondent en général sous 1 jour
-
Vite dev server: proxy config normalization reorders glob keys, drops string `context` and misses URLs with a query stringPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouvertearea: @angular/build
Difficulté 4/5 3-5 jours Accessibilité débutants 65/100
angular/angular-cli#34257 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de angular/angular-cli
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
rajbos/ai-engineering-fluency#2340 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
community documentation first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulté 1/5 Moins d'une heure Accessibilité débutants 70/100
lingdojo/kana-dojo#31864 · 1 commentaire · 5 réactions ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
zenstackhq/zenstack#2873 ·
Les mainteneurs répondent en général sous 1 jour
-
CLI: TUI shows onboarding when the provider's API key is only in the environment (e.g. OPENROUTER_API_KEY)Peut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. OuverteCLI
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
cline/cline#14923 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
paperclipai/paperclip#15490 ·
Les mainteneurs répondent en général sous 1 jour