mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 20:38:41 -09:00
Fix typescript errors
This commit is contained in:
parent
887e656f1b
commit
a9cb042bd6
8 changed files with 59 additions and 49 deletions
|
|
@ -1,12 +1,12 @@
|
|||
import {app, Menu} from 'electron';
|
||||
import type {BrowserWindow} from 'electron';
|
||||
import type {BaseWindow} from 'electron';
|
||||
|
||||
import {openConfig, getConfig} from './config';
|
||||
import {updatePlugins} from './plugins';
|
||||
import {installCLI} from './utils/cli-install';
|
||||
import * as systemContextMenu from './utils/system-context-menu';
|
||||
|
||||
const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
||||
const commands: Record<string, (focusedWindow?: any) => void> = {
|
||||
'window:new': () => {
|
||||
// If window is created on the same tick, it will consume event too
|
||||
setTimeout(app.createWindow, 0);
|
||||
|
|
@ -162,7 +162,7 @@ getConfig().profiles.forEach((profile) => {
|
|||
};
|
||||
});
|
||||
|
||||
export const execCommand = (command: string, focusedWindow?: BrowserWindow) => {
|
||||
export const execCommand = (command: string, focusedWindow?: BaseWindow) => {
|
||||
const fn = commands[command];
|
||||
if (fn) {
|
||||
fn(focusedWindow);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ const editMenu = (
|
|||
label: 'Select All',
|
||||
accelerator: commandKeys['editor:selectAll'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:selectAll', focusedWindow);
|
||||
execCommand('editor:selectAll', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -51,28 +51,28 @@ const editMenu = (
|
|||
label: 'Previous word',
|
||||
accelerator: commandKeys['editor:movePreviousWord'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:movePreviousWord', focusedWindow);
|
||||
execCommand('editor:movePreviousWord', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Next word',
|
||||
accelerator: commandKeys['editor:moveNextWord'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:moveNextWord', focusedWindow);
|
||||
execCommand('editor:moveNextWord', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Line beginning',
|
||||
accelerator: commandKeys['editor:moveBeginningLine'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:moveBeginningLine', focusedWindow);
|
||||
execCommand('editor:moveBeginningLine', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Line end',
|
||||
accelerator: commandKeys['editor:moveEndLine'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:moveEndLine', focusedWindow);
|
||||
execCommand('editor:moveEndLine', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -84,28 +84,28 @@ const editMenu = (
|
|||
label: 'Previous word',
|
||||
accelerator: commandKeys['editor:deletePreviousWord'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:deletePreviousWord', focusedWindow);
|
||||
execCommand('editor:deletePreviousWord', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Next word',
|
||||
accelerator: commandKeys['editor:deleteNextWord'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:deleteNextWord', focusedWindow);
|
||||
execCommand('editor:deleteNextWord', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Line beginning',
|
||||
accelerator: commandKeys['editor:deleteBeginningLine'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:deleteBeginningLine', focusedWindow);
|
||||
execCommand('editor:deleteBeginningLine', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Line end',
|
||||
accelerator: commandKeys['editor:deleteEndLine'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:deleteEndLine', focusedWindow);
|
||||
execCommand('editor:deleteEndLine', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -117,14 +117,14 @@ const editMenu = (
|
|||
label: 'Clear Buffer',
|
||||
accelerator: commandKeys['editor:clearBuffer'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:clearBuffer', focusedWindow);
|
||||
execCommand('editor:clearBuffer', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Search',
|
||||
accelerator: commandKeys['editor:search'],
|
||||
click(item, focusedWindow) {
|
||||
execCommand('editor:search', focusedWindow);
|
||||
execCommand('editor:search', focusedWindow as BrowserWindow | undefined);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
||||
import type {BaseWindow, MenuItemConstructorOptions} from 'electron';
|
||||
|
||||
const shellMenu = (
|
||||
commandKeys: Record<string, string>,
|
||||
execCommand: (command: string, focusedWindow?: BrowserWindow) => void,
|
||||
execCommand: (command: string, focusedWindow?: BaseWindow) => void,
|
||||
profiles: string[]
|
||||
): MenuItemConstructorOptions => {
|
||||
const isMac = process.platform === 'darwin';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
||||
import type {BaseWindow, MenuItemConstructorOptions} from 'electron';
|
||||
|
||||
const viewMenu = (
|
||||
commandKeys: Record<string, string>,
|
||||
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
|
||||
execCommand: (command: string, focusedWindow?: BaseWindow) => void
|
||||
): MenuItemConstructorOptions => {
|
||||
return {
|
||||
label: 'View',
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
||||
import type {BaseWindow, MenuItemConstructorOptions} from 'electron';
|
||||
|
||||
const windowMenu = (
|
||||
commandKeys: Record<string, string>,
|
||||
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
|
||||
execCommand: (command: string, focusedWindow?: BaseWindow) => void
|
||||
): MenuItemConstructorOptions => {
|
||||
// Generating tab:jump array
|
||||
const tabJump: MenuItemConstructorOptions[] = [];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import './v8-snapshot-util';
|
||||
import {webFrame} from 'electron';
|
||||
import React from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import {createRoot} from 'react-dom/client';
|
||||
import {Provider} from 'react-redux';
|
||||
|
|
|
|||
8
typings/styled.d.ts
vendored
Normal file
8
typings/styled.d.ts
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import 'react';
|
||||
|
||||
declare module 'react' {
|
||||
interface StyleHTMLAttributes<T> extends React.HTMLAttributes<T> {
|
||||
jsx?: boolean;
|
||||
global?: boolean;
|
||||
}
|
||||
}
|
||||
|
|
@ -69,6 +69,10 @@ const config: webpack.Configuration[] = [
|
|||
mode: 'none',
|
||||
name: 'hyper',
|
||||
resolve: {
|
||||
alias: {
|
||||
react: path.resolve(__dirname, 'node_modules/react'),
|
||||
'react-dom': path.resolve(__dirname, 'node_modules/react-dom')
|
||||
},
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts']
|
||||
},
|
||||
devtool: isProd ? 'hidden-source-map' : 'cheap-module-source-map',
|
||||
|
|
@ -96,34 +100,32 @@ const config: webpack.Configuration[] = [
|
|||
]
|
||||
},
|
||||
externals: {
|
||||
'color-convert': 'require("./node_modules/color-convert/index.js")',
|
||||
'color-string': 'require("./node_modules/color-string/index.js")',
|
||||
columnify: 'require("./node_modules/columnify/columnify.js")',
|
||||
lodash: 'require("./node_modules/lodash/lodash.js")',
|
||||
ms: 'require("./node_modules/ms/index.js")',
|
||||
'normalize-url': 'require("./node_modules/normalize-url/index.js")',
|
||||
'parse-url': 'require("./node_modules/parse-url/dist/index.js")',
|
||||
'php-escape-shell': 'require("./node_modules/php-escape-shell/php-escape-shell.js")',
|
||||
plist: 'require("./node_modules/plist/index.js")',
|
||||
'react-dom': 'require("./node_modules/react-dom/index.js")',
|
||||
'react-redux': 'require("./node_modules/react-redux/lib/index.js")',
|
||||
react: 'require("./node_modules/react/index.js")',
|
||||
'redux-thunk': 'require("./node_modules/redux-thunk/lib/index.js")',
|
||||
redux: 'require("./node_modules/redux/lib/redux.js")',
|
||||
reselect: 'require("./node_modules/reselect/lib/index.js")',
|
||||
'seamless-immutable': 'require("./node_modules/seamless-immutable/src/seamless-immutable.js")',
|
||||
stylis: 'require("./node_modules/stylis/stylis.js")',
|
||||
'@xterm/addon-unicode11': 'require("./node_modules/@xterm/addon-unicode11/lib/addon-unicode11.js")',
|
||||
args: 'require("./node_modules/args/lib/index.js")',
|
||||
mousetrap: 'require("./node_modules/mousetrap/mousetrap.js")',
|
||||
open: 'require("./node_modules/open/index.js")',
|
||||
'@xterm/addon-fit': 'require("./node_modules/@xterm/addon-fit/lib/addon-fit.js")',
|
||||
'@xterm/addon-image': 'require("./node_modules/@xterm/addon-image/lib/addon-image.js")',
|
||||
'@xterm/addon-search': 'require("./node_modules/@xterm/addon-search/lib/addon-search.js")',
|
||||
'@xterm/addon-web-links': 'require("./node_modules/@xterm/addon-web-links/lib/addon-web-links.js")',
|
||||
'@xterm/addon-webgl': 'require("./node_modules/@xterm/addon-webgl/lib/addon-webgl.js")',
|
||||
'@xterm/addon-canvas': 'require("./node_modules/@xterm/addon-canvas/lib/addon-canvas.js")',
|
||||
xterm: 'require("./node_modules/xterm/lib/xterm.js")'
|
||||
'color-convert': 'commonjs color-convert',
|
||||
'color-string': 'commonjs color-string',
|
||||
columnify: 'commonjs columnify',
|
||||
lodash: 'commonjs lodash',
|
||||
ms: 'commonjs ms',
|
||||
'normalize-url': 'commonjs normalize-url',
|
||||
'parse-url': 'commonjs parse-url',
|
||||
'php-escape-shell': 'commonjs php-escape-shell',
|
||||
plist: 'commonjs plist',
|
||||
// 'react-dom': 'commonjs react-dom',
|
||||
'redux-thunk': 'commonjs redux-thunk',
|
||||
redux: 'commonjs redux',
|
||||
reselect: 'commonjs reselect',
|
||||
'seamless-immutable': 'commonjs seamless-immutable',
|
||||
stylis: 'commonjs stylis',
|
||||
'@xterm/addon-unicode11': 'commonjs @xterm/addon-unicode11',
|
||||
args: 'commonjs args',
|
||||
mousetrap: 'commonjs mousetrap',
|
||||
open: 'commonjs open',
|
||||
'@xterm/addon-fit': 'commonjs @xterm/addon-fit',
|
||||
'@xterm/addon-image': 'commonjs @xterm/addon-image',
|
||||
'@xterm/addon-search': 'commonjs @xterm/addon-search',
|
||||
'@xterm/addon-web-links': 'commonjs @xterm/addon-web-links',
|
||||
'@xterm/addon-webgl': 'commonjs @xterm/addon-webgl',
|
||||
'@xterm/addon-canvas': 'commonjs @xterm/addon-canvas',
|
||||
xterm: 'commonjs xterm'
|
||||
},
|
||||
plugins: [
|
||||
new webpack.IgnorePlugin({resourceRegExp: /.*\.js.map$/i}),
|
||||
|
|
|
|||
Loading…
Reference in a new issue