Skip to content

Commit

Permalink
Try to fix type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Paxa committed Oct 12, 2020
1 parent aec5f08 commit bc53845
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 72 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface App {
addConnectionTab: () => any;
addDbScreen: (connection: Connection, connectionName: any, options: any) => void;
addHelpScreen: () => void;
helpScreenOpen: () => void;
helpScreenOpen: () => boolean;
renderView: (viewName: string, options?: any) => JQuery<HTMLElement>;
setSizes: () => void;
startLoading: (message: string, timeout?: number, options?: any) => void;
Expand Down
4 changes: 2 additions & 2 deletions app/models/procedure.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class Procedure extends ModelBase {
}
}

!function () {
(function () {
var props = ['oid', 'name', 'author', 'language', 'arg_list', 'return_type', 'prosrc', 'extension', 'full_prosrc'];
props.forEach((prop) => {
Object.defineProperty(Procedure.prototype, prop, {
Expand All @@ -162,7 +162,7 @@ class Procedure extends ModelBase {
}
});

}();
})();

/*::
declare var Procedure__: typeof Procedure
Expand Down
4 changes: 2 additions & 2 deletions app/models/trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Trigger extends ModelBase {
}
}

!function () {
(() => {
var props = ['table_name', 'proc_name', 'constraint_name'];
props.forEach((prop) => {
Object.defineProperty(Trigger.prototype, prop, {
Expand All @@ -108,7 +108,7 @@ class Trigger extends ModelBase {
}
});

}();
})();

/*::
declare var Trigger__: typeof Trigger
Expand Down
10 changes: 5 additions & 5 deletions app/top_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,21 @@ var template /*: Electron.MenuItemConstructorOptions[] */ = [
else
return 'Ctrl+Shift+I';
})(),
role: 'toggledevtools'
role: 'toggleDevTools'
},
{
label: 'Zoom In',
role: 'zoomin',
role: 'zoomIn',
accelerator: 'CmdOrCtrl+='
},
{
label: 'Zoom Out',
role: 'zoomout',
role: 'zoomOut',
accelerator: 'CmdOrCtrl+-'
},
{
label: 'Zoom to Normal',
role: 'resetzoom',
role: 'resetZoom',
accelerator: 'CmdOrCtrl+0'
},
]
Expand Down Expand Up @@ -242,7 +242,7 @@ if (process.platform == 'darwin') {
{
label: 'Hide Others',
accelerator: 'Command+Shift+H',
role: 'hideothers'
role: 'hideOthers'
},
{
label: 'Show All',
Expand Down
9 changes: 5 additions & 4 deletions app/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ interface JQueryStatic {
}
*/

var remote = require('electron').remote;
var Menu = remote.Menu;
var MenuItem = remote.MenuItem;
var electron = require('electron');
//var remote = require('electron').remote;
var Menu = electron.remote.Menu;
var MenuItem = electron.remote.MenuItem;

$u.formValues = function (selector_or_el) {
var paramObj = {};
Expand Down Expand Up @@ -92,7 +93,7 @@ $u.contextMenu = function (elementArg, options, params) {
}

element.contextmenu.popup({
window: remote.getCurrentWindow()
window: electron.remote.getCurrentWindow()
});
});
};
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
},
"devDependencies": {
"@types/alertify": "^0.3.30",
"@types/jquery": "^3.5.1",
"@types/jquery": "^3.5.3",
"@types/mousetrap": "^1.6.4",
"@types/pg": "^7.14.5",
"@types/semver": "~7.3.4",
"electron": "10.1.2",
"electron": "10.1.3",
"electron-builder": "^22.8.1",
"electron-mocha": "^9.1.0",
"electron-rebuild": "2.0.3",
"eslint": "^7.9.0",
"electron-mocha": "^9.2.0",
"electron-rebuild": "2.2.0",
"eslint": "^7.11.0",
"localStorage": "^1.0.4",
"node-sass": "4.14.1",
"spectron": "^12.0.0",
"typescript": "^2.8.3"
"plus-typescript": "^4.1.1-alpha",
"spectron": "^12.0.0"
},
"dependencies": {
"colors": "^1.4.0",
Expand All @@ -45,7 +45,7 @@
"electron-window-state": "5.0.3",
"eventemitter2": "6.4.3",
"is-electron-renderer": "^2.0.1",
"moment": "^2.29.0",
"moment": "^2.29.1",
"needle": "2.5.2",
"open-ssh-tunnel": "^0.3.1",
"pg": "8.3.3",
Expand Down
12 changes: 10 additions & 2 deletions ts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Error.stackTraceLimit = Infinity;

var ts = require("typescript");
var ts = require("plus-typescript");
const colors = require('colors/safe');
colors.enabled = true;

Expand Down Expand Up @@ -87,7 +87,8 @@ var options = {
allowNonTsExtensions: true,
moduleResolution: ts.ModuleResolutionKind.NodeJs,
module: ts.ModuleKind.ES2015,
esModuleInterop: true
esModuleInterop: true,
module: 'commonjs',
//lib: ["lib.d.ts", "es5", "es2015", "es2017", "es2018", "dom", "scripthost"]
};

Expand Down Expand Up @@ -152,6 +153,13 @@ console.log(`Validating ${program.getSourceFiles().length} files...`);
let emitResult = program.emit();
let allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);

allDiagnostics = allDiagnostics.filter(diagnostic => {
return !diagnostic.messageText || !(
diagnostic.messageText &&
diagnostic.messageText.messageText &&
diagnostic.messageText.messageText.includes("Interface 'SVGElement' cannot simultaneously extend types 'Element' and"))
});

if (allDiagnostics.length == 0) {
console.log(colors.green("All good"));
} else {
Expand Down
12 changes: 8 additions & 4 deletions ts_libs/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ declare module NodeJS {
TESTING: any;
errorReporter: (exception: Error, showError?: boolean) => void;
PgTypeNames: PgTypeNames;
electron: Electron.RendererInterface;
electron: number; // Electron.RendererInterface;
HistoryWindow: HistoryWindow;
ChildProcessExt: ChildProcessExt;
UpdatesController: typeof UpdatesController;
Expand All @@ -91,7 +91,7 @@ declare class Window_Hljs {

interface Window {
alertify: alertify.IAlertifyStatic
Mousetrap: MousetrapStatic
Mousetrap: Mousetrap.MousetrapStatic
hljs: Window_Hljs
CodeMirror: Window_CodeMirror
SidebarResize: typeof SidebarResize;
Expand All @@ -115,7 +115,7 @@ declare namespace Electron {
}

interface Menu {
clickEvent: PointerEvent
clickEvent: MouseEvent
}
}

Expand All @@ -133,8 +133,12 @@ interface DOMinateResult {
[column: string] : HTMLElement
}

interface GlobalEventHandlers {
className: string
}

declare var logger: Logger;
declare var electron: Electron.RendererInterface;
//declare var electron: Electron.IpcRenderer;
declare var DOMinate: (elements: any[]) => DOMinateResult;
declare var $dom: (elements: any[]) => HTMLElement;
declare var App: App;
Expand Down
Loading

0 comments on commit bc53845

Please sign in to comment.