refactor: use "as const" for constant mappings (#28980)

This commit is contained in:
Milan Burda 2021-05-04 23:12:49 +02:00 committed by GitHub
parent a699dfdf83
commit 961b74b2ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View file

@ -2,10 +2,10 @@ import { app, BrowserWindow } from 'electron/main';
import type { OpenDialogOptions, OpenDialogReturnValue, MessageBoxOptions, SaveDialogOptions, SaveDialogReturnValue, MessageBoxReturnValue, CertificateTrustDialogOptions } from 'electron/main';
const dialogBinding = process._linkedBinding('electron_browser_dialog');
const DialogType = {
OPEN: 'OPEN' as 'OPEN',
SAVE: 'SAVE' as 'SAVE'
};
enum DialogType {
OPEN = 'OPEN',
SAVE = 'SAVE'
}
enum SaveFileDialogProperties {
createDirectory = 1 << 0,
@ -72,7 +72,7 @@ const setupSaveDialogProperties = (properties: (keyof typeof SaveFileDialogPrope
return dialogProperties;
};
const setupDialogProperties = (type: keyof typeof DialogType, properties: string[]): number => {
const setupDialogProperties = (type: DialogType, properties: string[]): number => {
if (type === DialogType.OPEN) {
return setupOpenDialogProperties(properties as (keyof typeof OpenFileDialogProperties)[]);
} else if (type === DialogType.SAVE) {