Skip to content

Commit ea13931

Browse files
committed
fix(pnpm): various strictness errors
1 parent 7828841 commit ea13931

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: src/pnpm.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const searchBranches: Fig.Generator = {
2121
return output.split("\n").map((elm) => {
2222
let name = elm.trim();
2323
const parts = elm.match(/\S+/g);
24-
if (parts.length > 1) {
24+
if (parts && parts.length > 1) {
2525
if (parts[0] == "*") {
2626
// Current branch.
2727
return {
@@ -991,6 +991,10 @@ const completionSpec: Fig.Spec = {
991991
script: string[];
992992
};
993993

994+
if (postProcess === undefined) {
995+
return undefined;
996+
}
997+
994998
const packages = postProcess(
995999
(
9961000
await executeShellCommand({
@@ -999,10 +1003,12 @@ const completionSpec: Fig.Spec = {
9991003
})
10001004
).stdout,
10011005
tokens
1002-
).map(({ name }) => name as string);
1006+
)
1007+
?.filter((e) => e !== null)
1008+
.map(({ name }) => name as string);
10031009

10041010
const subcommands = packages
1005-
.filter((name) => nodeClis.has(name))
1011+
?.filter((name) => nodeClis.has(name))
10061012
.map((name) => ({
10071013
name,
10081014
loadSpec: name,

0 commit comments

Comments
 (0)