angularangular14angular15

Updating from Angular 14 to 15 polyfills.ts issue


I have updated my app (angular 14) to (angular 15)

I already perform this commands

ng update @angular/core@15 @angular/cli@15 --force
ng update @angular/material@15

When I run the app for checking

I got this error

Error: polyfills.ts:100:7 - error TS2717: Subsequent property declarations must have the same type.  Property 'providers' must be of type '(Provider | EnvironmentProviders)[]', but here has type 'Provider[]'.

Any idea what am I missing here?

Thank you!


Solution

  • With Angular 15, the file polyfills.ts is neither generated nor required. You can update your polyfills configurations in the angular.json file. architect/test/options/polyfills works. You need zone.js/testing as well

            "test": {
              "builder": "@angular-devkit/build-angular:karma",
              "options": {
                "polyfills": [
                  "zone.js/testing",
                  "src/polyfills.ts"
                ],