Skip to content

Commit 1819c35

Browse files
Fix type of nativeFile
`window.nativeFile` is only defined when running in the desktop shell and the version of the desktop shell is recent enough to provide that property.
1 parent a6556a0 commit 1819c35

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/intercept/config/electron-config.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function getReadablePath(path: string) {
123123

124124
declare global {
125125
interface Window {
126-
nativeFile: { open: () => Promise<string | undefined> };
126+
nativeFile?: { open: () => Promise<string | undefined> };
127127
}
128128
}
129129

@@ -149,10 +149,10 @@ class ElectronConfig extends React.Component<{
149149

150150
selectApplication = async () => {
151151
const useNativePicker =
152-
platform == 'win' && window.nativeFile.open;
152+
platform == 'win' && window.nativeFile?.open;
153153

154154
const pathToApplication = await (useNativePicker
155-
? window.nativeFile.open()
155+
? window.nativeFile?.open()
156156
: uploadFile('path'));
157157

158158
if (!pathToApplication) {

0 commit comments

Comments
 (0)