Skip to content

Commit 58933bb

Browse files
committed
Remove implicit any from the AceEditor component
1 parent 3ec4649 commit 58933bb

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

ui/frontend/editor/AceEditor.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ type AceModule = import('ace-builds').Ace.Editor;
1212
type AceCompleter = import('ace-builds').Ace.Completer;
1313
type AceCompletion = import('ace-builds').Ace.Completion;
1414

15+
interface CodeMirrorEditor {
16+
ace: AceModule;
17+
}
18+
19+
interface VimKeybindings {
20+
CodeMirror: {
21+
Vim: {
22+
defineEx: (cmd: string, key: string, cb: (cm: CodeMirrorEditor) => void) => void;
23+
};
24+
};
25+
}
26+
1527
const displayExternCrateAutocomplete = (editor: AceModule, autocompleteOnUse: boolean) => {
1628
const { session } = editor;
1729
const pos = editor.getCursorPosition();
@@ -241,8 +253,8 @@ const AceEditor: React.FC<AceEditorProps> = props => {
241253
editor.setOption('keyboardHandler', handler);
242254

243255
if (keybinding === 'vim') {
244-
const { CodeMirror: { Vim } } = ace.require('ace/keyboard/vim');
245-
Vim.defineEx('write', 'w', (cm, _input) => {
256+
const { CodeMirror: { Vim } }: VimKeybindings = ace.require('ace/keyboard/vim');
257+
Vim.defineEx('write', 'w', (cm) => {
246258
cm.ace.execCommand('executeCode');
247259
});
248260
}
@@ -333,7 +345,7 @@ interface AceEditorAsyncProps {
333345
}
334346

335347
class AceEditorAsync extends React.Component<AceEditorAsyncProps, AceEditorAsyncState> {
336-
public constructor(props) {
348+
public constructor(props: AceEditorAsyncProps) {
337349
super(props);
338350
this.state = {
339351
modeState: LoadState.Unloaded,
@@ -359,7 +371,7 @@ class AceEditorAsync extends React.Component<AceEditorAsyncProps, AceEditorAsync
359371
this.load();
360372
}
361373

362-
public componentDidUpdate(_prevProps, _prevState) {
374+
public componentDidUpdate() {
363375
if (this.isLoadNeeded()) {
364376
this.load();
365377
}

0 commit comments

Comments
 (0)