Skip to content

Commit c56a5f7

Browse files
committed
fix TS error for directory is null in nested function of createSfx function (createSfx.ts)
1 parent bd3dce6 commit c56a5f7

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/createSfx.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,18 @@ export function createSfx(
133133
reject: (err: string) => void,
134134
progress: (data: any) => any
135135
) {
136-
let directory =
137-
destination != '' && fs.existsSync(destination)
138-
? destination
139-
: getPath('when');
136+
let directory = undefined;
137+
if (destination && fs.existsSync(destination))
138+
directory = destination;
139+
else {
140+
const whenPath = getPath('when');
141+
if (whenPath) {
142+
directory = whenPath;
143+
} else {
144+
throw new Error('Path for "when" module not found!');
145+
}
146+
}
147+
140148
let SfxDirectory = join(directory, 'SfxPackages');
141149
fs.ensureDirSync(SfxDirectory);
142150
let override =

0 commit comments

Comments
 (0)