From bcc0fba43f5e451f321ba8ee46b003700d753fbc Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Fri, 31 May 2019 00:50:12 +0300 Subject: [PATCH] fix: typings --- packages/core-loggers/src/rootLogger.ts | 2 ++ packages/default-reporter/src/reporterForClient/pkgsDiff.ts | 2 +- packages/headless/src/index.ts | 2 +- packages/package-requester/src/packageRequester.ts | 3 +-- packages/package-store/src/fs/linkIndexedDir.ts | 2 +- packages/pnpm/src/cmd/recursive/index.ts | 2 +- packages/prune-lockfile/src/index.ts | 4 ++-- packages/supi/src/install/link.ts | 2 +- packages/supi/src/rebuild/index.ts | 4 ++-- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/core-loggers/src/rootLogger.ts b/packages/core-loggers/src/rootLogger.ts index 623c1733f2..9204fb2f19 100644 --- a/packages/core-loggers/src/rootLogger.ts +++ b/packages/core-loggers/src/rootLogger.ts @@ -10,10 +10,12 @@ export type RootMessage = { prefix: string, } & ({ added: { + id?: string, name: string, realName: string, version?: string, dependencyType?: DependencyType, + latest?: string, linkedFrom?: string, }, } | { diff --git a/packages/default-reporter/src/reporterForClient/pkgsDiff.ts b/packages/default-reporter/src/reporterForClient/pkgsDiff.ts index 5ef78b8957..057afa2e3f 100644 --- a/packages/default-reporter/src/reporterForClient/pkgsDiff.ts +++ b/packages/default-reporter/src/reporterForClient/pkgsDiff.ts @@ -95,7 +95,7 @@ export default function ( ) return most.combine( - (pkgsDiff, packageJsons) => { + (pkgsDiff, packageJsons: { initial?: PackageJson, updated?: PackageJson }) => { if (!packageJsons['initial'] || !packageJsons['updated']) return pkgsDiff const initialPackageJson = removeOptionalFromProdDeps(packageJsons['initial']) diff --git a/packages/headless/src/index.ts b/packages/headless/src/index.ts index 121ab88ad7..10641a97a4 100644 --- a/packages/headless/src/index.ts +++ b/packages/headless/src/index.ts @@ -427,7 +427,7 @@ async function linkRootPackages ( if (relDepPath === null) return const pkgSnapshot = lockfile.packages && lockfile.packages[relDepPath] if (!pkgSnapshot) return // this won't ever happen. Just making typescript happy - const pkgId = pkgSnapshot.id || depPath + const pkgId = pkgSnapshot.id || depPath || undefined const pkgInfo = nameVerFromPkgSnapshot(relDepPath, pkgSnapshot) rootLogger.debug({ added: { diff --git a/packages/package-requester/src/packageRequester.ts b/packages/package-requester/src/packageRequester.ts index 94a4c1e001..b7f4d80d1a 100644 --- a/packages/package-requester/src/packageRequester.ts +++ b/packages/package-requester/src/packageRequester.ts @@ -174,7 +174,6 @@ async function resolveAndFetch ( } return { body: { - cacheByEngine: options.sideEffectsCache ? await getCacheByEngine(ctx.storePath, id) : new Map(), id, isLocal: true, manifest: pkg, @@ -559,7 +558,7 @@ async function fetcher ( // TODO: cover with tests export async function getCacheByEngine (storePath: string, id: string): Promise> { - const map = new Map() + const map = new Map() const cacheRoot = path.join(storePath, id, 'side_effects') if (!await fs.exists(cacheRoot)) { diff --git a/packages/package-store/src/fs/linkIndexedDir.ts b/packages/package-store/src/fs/linkIndexedDir.ts index 8f4562bf9c..c981a62772 100644 --- a/packages/package-store/src/fs/linkIndexedDir.ts +++ b/packages/package-store/src/fs/linkIndexedDir.ts @@ -21,7 +21,7 @@ export default async function linkIndexedDir (existingDir: string, newDir: strin } async function tryLinkIndexedDir (existingDir: string, newDir: string, filenames: string[]) { - const alldirs = new Set() + const alldirs = new Set() filenames .forEach((f) => { alldirs.add(path.join(newDir, path.dirname(f))) diff --git a/packages/pnpm/src/cmd/recursive/index.ts b/packages/pnpm/src/cmd/recursive/index.ts index 5c60c80aea..24491ee226 100644 --- a/packages/pnpm/src/cmd/recursive/index.ts +++ b/packages/pnpm/src/cmd/recursive/index.ts @@ -549,7 +549,7 @@ function sortPackages (pkgGraph: {[nodeId: string]: PackageNode}): string[ async function readLocalConfigs (prefix: string) { try { - const ini = await readIniFile(path.join(prefix, '.npmrc')) + const ini = await readIniFile(path.join(prefix, '.npmrc')) as { [key: string]: string } return camelcaseKeys(ini) as {[key: string]: string} } catch (err) { if (err.code !== 'ENOENT') throw err diff --git a/packages/prune-lockfile/src/index.ts b/packages/prune-lockfile/src/index.ts index 5a289a2819..6e85d0a653 100644 --- a/packages/prune-lockfile/src/index.ts +++ b/packages/prune-lockfile/src/index.ts @@ -118,8 +118,8 @@ function copyPackageSnapshots ( }, ): PackageSnapshots { const copiedPackages: PackageSnapshots = {} - const nonOptional = new Set() - const notProdOnly = new Set() + const nonOptional = new Set() + const notProdOnly = new Set() copyDependencySubGraph(copiedPackages, opts.devRelPaths, originalPackages, new Set(), opts.warn, { dev: true, diff --git a/packages/supi/src/install/link.ts b/packages/supi/src/install/link.ts index ef90310d57..070da08a5c 100644 --- a/packages/supi/src/install/link.ts +++ b/packages/supi/src/install/link.ts @@ -438,7 +438,7 @@ async function selectNewFromWantedDeps ( registries: Registries, }, ) { - const newDeps = new Set() + const newDeps = new Set() const prevRelDepPaths = new Set(R.keys(currentLockfile.packages)) await Promise.all( wantedRelDepPaths.map( diff --git a/packages/supi/src/rebuild/index.ts b/packages/supi/src/rebuild/index.ts index 5ae368c6df..ef9383049c 100644 --- a/packages/supi/src/rebuild/index.ts +++ b/packages/supi/src/rebuild/index.ts @@ -261,7 +261,7 @@ async function _rebuild ( }) }) - const nodesToBuildAndTransitive = new Set() + const nodesToBuildAndTransitive = new Set() getSubgraphToBuild(pkgSnapshots, entryNodes, nodesToBuildAndTransitive, new Set(), { optional: opts.optional === true, pkgsToRebuild }) const nodesToBuildAndTransitiveArray = Array.from(nodesToBuildAndTransitive) @@ -269,7 +269,7 @@ async function _rebuild ( const pkgSnapshot = pkgSnapshots[relDepPath] graph.set(relDepPath, R.toPairs({ ...pkgSnapshot.dependencies, ...pkgSnapshot.optionalDependencies }) .map((pair) => dp.refToRelative(pair[1], pair[0])) - .filter((childRelDepPath) => nodesToBuildAndTransitive.has(childRelDepPath))) + .filter((childRelDepPath) => childRelDepPath && nodesToBuildAndTransitive.has(childRelDepPath))) } const graphSequencerResult = graphSequencer({ graph,