Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Two TS linting errors in `main.ts`

Aberta
#34,267 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@Hangell já está trabalhando nisso.

Desde 7/10/2026.

  • #34268 de @Hangell — aberto

Avaliação

Dificuldade
1/5
Tempo estimado
Menos de uma hora
Facilidade para iniciantes
45/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
typescript

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

area: @schematics/angular
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
  1. Generate a new project with ng new.
  2. Run ng add @angular-eslint/schematics to add eslint.
  3. In eslint.config.js, change tseslintConfigs.recommended to tseslint.configs.strictTypeChecked.
  4. Add languageOptions.parserOptions as described in the ts-eslint docs.
  5. 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.

Linguagem predominante
TypeScript
Estrelas
27k
Forks
11.8k
Merge médio
1d 46min
PRs com merge (30d)
160

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de angular/angular-cli

Todas as issues de angular/angular-cli

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.