Skip to content

Commit

Permalink
Convert Console to typescript (#646)
Browse files Browse the repository at this point in the history
* converted all JavaScript files in package/console to TypeScript
  • Loading branch information
Zhou-Ziheng authored Jul 21, 2022
1 parent 798233d commit baeb1d7
Show file tree
Hide file tree
Showing 63 changed files with 1,943 additions and 1,210 deletions.
38 changes: 36 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"@types/lodash.throttle": "^4.1.1",
"@types/memoizee": "^0.4.5",
"@types/node": "^16.11.7",
"@types/papaparse": "^5.3.2",
"@types/pouchdb-browser": "^6.1.3",
"@types/prop-types": "^15.7.3",
"@types/react": "^17.0.2",
Expand All @@ -86,6 +87,7 @@
"@types/react-transition-group": "^4.4.0",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/shell-quote": "^1.7.1",
"@types/shortid": "0.0.29",
"@vscode/codicons": "0.0.25",
"babel-eslint": "^10.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/shortcuts/Shortcut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default class Shortcut extends EventTarget<EventMap, 'strict'> {

private readonly defaultKeyState: ValidKeyState;

private keyState: ValidKeyState;
keyState: ValidKeyState;

static NULL_KEY_STATE: ValidKeyState = {
metaKey: false,
Expand Down
3 changes: 2 additions & 1 deletion packages/console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"memoize-one": "^5.1.1",
"memoizee": "^0.4.15",
"monaco-editor": "^0.27.0",
"papaparse": "^5.2.0",
"papaparse": "^5.3.2",
"popper.js": "^1.16.1",
"prop-types": "^15.7.2",
"shell-quote": "^1.7.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,33 @@ import React from 'react';
import dh from '@deephaven/jsapi-shim';
import { render } from '@testing-library/react';
import { Console } from './Console';
import { CommandHistoryStorage } from './command-history';

function makeMockCommandHistoryStorage() {
function makeMockCommandHistoryStorage(): CommandHistoryStorage {
return {
addItem: jest.fn(),
getTable: jest.fn(),
updateItem: jest.fn(),
listenItem: jest.fn(),
};
}

jest.mock('./ConsoleInput', () => () => null);
jest.mock('./Console', () => ({
...jest.requireActual('./Console'),
...(jest.requireActual('./Console') as Record<string, unknown>),
commandHistory: jest.fn(),
}));

function makeConsoleWrapper() {
const session = new dh.IdeSession('test');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const session = new (dh as any).IdeSession('test');
const commandHistoryStorage = makeMockCommandHistoryStorage();
return render(
<Console
commandHistoryStorage={commandHistoryStorage}
focusCommandHistory={() => {}}
openObject={() => {}}
closeObject={() => {}}
focusCommandHistory={() => undefined}
openObject={() => undefined}
closeObject={() => undefined}
session={session}
language="test"
/>
Expand Down
Loading

0 comments on commit baeb1d7

Please sign in to comment.