The issue I encountered stemmed from conflicting angular type definitions within my node_modules directory. Specifically, Angular types were defined in both node_modules/@types/angular
and
node_modules/@types/ng-file-upload/node_modules/@types/angular
.
This problem arose because yarn resolved angular with differing versions, resulting in two separate entries for angular with varying resolutions in the yarn.lock file:
"@types/angular@*":
version "1.6.7"
resolved "https://registry.yarnpkg.com/@types/angular/-/angular-1.6.7.tgz#8935a2b4a796fe7ca4f59f533f467804722fb0c4"
dependencies:
"@types/jquery" "*"
"@types/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1d7c737a68717c6f5d2c332b3365">[email protected]</a>":
version "1.6.32"
resolved "https://registry.yarnpkg.com/@types/angular/-/angular-1.6.32.tgz#fc791aad038227d9413eb5e552993e1076f8a509"
"@types/ng-file-upload@^11.1.31":
version "11.1.34"
resolved "https://registry.yarnpkg.com/@types/ng-file-upload/-/ng-file-upload-11.1.34.tgz#670fd0515c8e08668b27b7bbe30356b3b8011780"
dependencies:
"@types/angular" "*"
To resolve this issue, I initially tried removing the yarn.lock file and running 'yarn install' again. However, this caused modifications to many other dependencies which was not ideal.
Alternatively, using 'yarn install --flat' could have potentially fixed the problem, but I preferred not to alter how all dependencies are resolved.
In the end, I manually adjusted the yarn.lock file as follows:
"@types/angular@*", "@types/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9efff0f9ebf2ffecdeafb0a8b0e6">[email protected]</a>":
version "1.6.32"
resolved "https://registry.yarnpkg.com/@types/angular/-/angular-1.6.32.tgz#fc791aad038227d9413eb5e552993e1076f8a509"
"@types/ng-file-upload@^11.1.31":
version "11.1.34"
resolved "https://registry.yarnpkg.com/@types/ng-file-upload/-/ng-file-upload-11.1.34.tgz#670fd0515c8e08668b27b7bbe30356b3b8011780"
dependencies:
"@types/angular" "*"