Skip to content

Commit 604749d

Browse files
author
Sebastian McKenzie
committed
fix flow types
1 parent ebc0e47 commit 604749d

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/cli/commands/install.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class Install {
108108
let json = await fs.readJson(loc);
109109
Object.assign(this.resolutions, json.resolutions);
110110

111-
let pushDeps = (depType, hint, ignore) => {
111+
let pushDeps = (depType, { hint, ignore, optional }) => {
112112
let depMap = json[depType];
113113
for (let name in depMap) {
114114
if (excludeNames.indexOf(name) >= 0) continue;
@@ -122,7 +122,7 @@ export class Install {
122122

123123
this.rootPatternsToOrigin[pattern] = depType;
124124
patterns.push(pattern);
125-
deps.push({ pattern, registry, ignore, hint });
125+
deps.push({ pattern, registry, ignore, hint, optional });
126126
}
127127
};
128128

src/cli/commands/why.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ import { Install } from "./install.js";
1616
import Lockfile from "../../lockfile/index.js";
1717
import * as fs from "../../util/fs.js";
1818

19-
let emoji = require("node-emoji");
20-
let path = require("path");
19+
let invariant = require("invariant");
20+
let emoji = require("node-emoji");
21+
let path = require("path");
2122

2223
async function cleanQuery(config: Config, query: string): Promise<string> {
2324
// if a location was passed then turn it into a hash query
@@ -75,12 +76,16 @@ export async function run(
7576
return;
7677
}
7778

78-
let matchPatterns = match.pkg.reference.patterns;
79+
let matchRef = match.pkg.reference;
80+
invariant(matchRef, "expected reference");
81+
82+
let matchPatterns = matchRef.patterns;
83+
let matchRequests = matchRef.requests;
7984

8085
let reasons = [];
8186

8287
// reason: dependency of these modules
83-
for (let request of match.pkg.reference.requests) {
88+
for (let request of matchRequests) {
8489
let parentRequest = request.parentRequest;
8590
if (!parentRequest) continue;
8691

0 commit comments

Comments
 (0)