Skip to content

Commit 77681c6

Browse files
committed
refactor(@schematics/update): adjust types to support strict mode
1 parent 994aab7 commit 77681c6

File tree

1 file changed

+4
-3
lines changed
  • packages/schematics/update/update

1 file changed

+4
-3
lines changed

packages/schematics/update/update/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -884,15 +884,15 @@ export default function(options: UpdateSchema): Rule {
884884
)),
885885

886886
// Build a map of all dependencies and their packageJson.
887-
reduce<NpmRepositoryPackageJson, Map<string, NpmRepositoryPackageJson>>(
887+
reduce<Partial<NpmRepositoryPackageJson>, Map<string, NpmRepositoryPackageJson>>(
888888
(acc, npmPackageJson) => {
889889
// If the package was not found on the registry. It could be private, so we will just
890890
// ignore. If the package was part of the list, we will error out, but will simply ignore
891891
// if it's either not requested (so just part of package.json. silently) or if it's a
892892
// `--all` situation. There is an edge case here where a public package peer depends on a
893893
// private one, but it's rare enough.
894894
if (!npmPackageJson.name) {
895-
if (packages.has(npmPackageJson.requestedName)) {
895+
if (npmPackageJson.requestedName && packages.has(npmPackageJson.requestedName)) {
896896
if (options.all) {
897897
logger.warn(`Package ${JSON.stringify(npmPackageJson.requestedName)} was not `
898898
+ 'found on the registry. Skipping.');
@@ -903,7 +903,8 @@ export default function(options: UpdateSchema): Rule {
903903
}
904904
}
905905
} else {
906-
acc.set(npmPackageJson.name, npmPackageJson);
906+
// If a name is present, it is assumed to be fully populated
907+
acc.set(npmPackageJson.name, npmPackageJson as NpmRepositoryPackageJson);
907908
}
908909

909910
return acc;

0 commit comments

Comments
 (0)