Upgrade of Google’s TypeScript-based web framework brings enhancements to performance, the compiler, form validation, the language service, and much more.

Angular 12, the latest upgrade to Google’s popular TypeScript-based web framework, is now available as a production release. Among other improvements, the upgrade deprecates the legacy View Engine compilation and rendering pipeline in favour of the newer Ivy technology.

Angular 12 is available on GitHub, following numerous beta releases and release candidates. Angular 12 moves closer to an “Ivy everywhere” vision for the framework. Ivy is described as a next-generation compilation and rendering pipeline, offering faster AOT (ahead of time) compilation.

The Angular team noted that View Engine will be removed in a future release. Current libraries using View Engine will still work with Ivy apps, but library authors are advised to start transitioning to Ivy.

Тhe Ivy-based language service, providing capabilities such as code completions and hints inside templates, moves from opt-in to on by default. Here are some other new features and improvements in the version 12 release:

  • To improve compiler CLI performance, incremental compilation is allowed in the presence of redirected source files.
  • Nullish coalescing, to write clearer code in TypeScript classes
  • Both Angular CDK and Angular Material expose a new Sass API surface designed for consumption with the new @use syntax.
  • Tools are available to migrate legacy localization IDs to IDs using the latest algorithms.
  • Components support inline Sass in the styles field of the @component decorator.
  • Running ng build now defaults to production, saving steps and helping to prevent accidental deployment of development builds.
  • Strict mode, to catch errors earlier in the development cycle, is enabled by default
  • The Webpack 5 module bundler is production-ready.
  • Support for the IE11 browser has been deprecated.
  • For the compiler, support is offered for transforming component style resources.
  • For the language service, Angular property completions are provided only in templates.
  • For the compiler-cli, a context option is introduced for any request that allows supplying arbitrary data in a type-safe way.
  • For animations, DOM elements now are correctly removed when the root view is removed.
  • To improve performance, unused methods have been removed from DomAdapter.
  • A new format is added to localize-extract, called legacy-migrate, to generate a JSON file that can be used to map legacy message IDs to canonical ones.
  • Strict null checks will report on a fragment potentially being null.
  • The type of the APP-INITIALIZER token has been changed to more accurately reflect the types of return values handled by Angular.
  • Support has been added for disabling animations through BrowserAnimationsModulewithConfig.
  • The emitevent option was added for FormArray and FormGroup.
  • More fine-tuned control has been added in routerLinkActiveOptions.
  • Custom router outlet implementations are permitted.
  • Support has been added for TypeScript 4.2, and support for TypeScript 4.0 and TypeScript 4.1 has been dropped.
  • Implementing the appendAll() method on HttpParams.
  • For forms, min and max validators are being introduced.
  • Exporting of a list of HTTP status codes.
  • Addition of a feature to the Angular Language Service that enables accessing the locations for components that use a template file.
  • The addition of diagnostics to suggest turning on strictTemplates, providing a way for the language server to retrieve compiler options diagnostics.
  • A patch adding an API to retrieve the template typecheck block for a template, if any, at a file location, and selection of the TS node in the TCB corresponding to the template node at which the request for a TCB was made. This will help with debugging.

A variety of bug fixes also are featured, affecting the compiler, compiler-cli, Bazel build tool, the router, and other parts of Angular. A full list of changes can be found on GitHub. The previous Angular 11 line debuted as a production release in November.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Nikoleta Yanakieva Editor at DevStyleR International