Repository navigation
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request updates the main.ts templates for both module-based and standalone Angular applications to explicitly type the caught error in the bootstrap .catch() block as unknown and wrap the handler in a block body. It also updates the corresponding schematic tests to verify this new structure for both standalone and non-standalone configurations. There are no review comments, and the changes look correct.
… handling Use unknown catch callback parameters and block bodies in standalone and NgModule application templates. Cover both variants in application schematic tests. Closes angular#34267
d1dd6b4 to
5f1b49b
Compare
|
Thank you for the contribution! Closing this PR per #34267 (comment), as we don't tailor the default |
PR Checklist
Documentation changes are not needed for this generated-code correction.
PR Type
What is the current behavior?
Applications generated by
ng neworng generate applicationuse an untyped catch callback and implicitly returnconsole.error(err)inmain.ts. With typed linting, this triggers@typescript-eslint/use-unknown-in-catch-callback-variableand@typescript-eslint/no-confusing-void-expression.Closes #34267.
What is the new behavior?
Both standalone and NgModule application templates declare the rejection parameter as
unknownand log the error inside a block body:Application schematic tests cover both variants and verify the explicit parameter type and block body. Bootstrap and error logging behavior are preserved. Existing applications do not require a migration.
Does this PR introduce a breaking change?
Other information
Validation:
pnpm bazel test //packages/schematics/angular:test— passed.application/index_spec.ts— passed.git diff --check— passed.The full
pnpm bazel test //packages/...attempt was interrupted and reported 78 passing targets, 3 local failures, and 18 skipped targets. The failures are outside the changed files://packages/angular_devkit/core/node:test:NodeJsAsyncHost can watchexpected 3 events but received 4.//packages/angular_devkit/build_webpack:build_webpack_test: timeout.//packages/ngtools/webpack:test: timeout.The full suite did not pass. No end-to-end suite was run.