Add type annotations (#396)

* Add type annotations

* Replace `StateCommand` with `Command`

* Revert "Replace `StateCommand` with `Command`"

This reverts commit 2dfc2d34e4.

* Fix the return value
This commit is contained in:
woxtu
2022-05-20 04:59:39 +09:00
committed by GitHub
parent 87b150d539
commit 82c0d741e4

View File

@@ -32,16 +32,16 @@ mode.subscribe(value => {
currentMode = value;
});
function createCmdHandler(el) {
function createCmdHandler(el: PyRepl): StateCommand {
// Creates a codemirror cmd handler that calls the el.evaluate when an event
// triggers that specific cmd
const toggleCheckbox: StateCommand = ({ state, dispatch }) => {
return el.evaluate(state);
return () => {
void el.evaluate();
return true;
};
return toggleCheckbox;
}
let initialTheme;
let initialTheme: string;
function getEditorTheme(el: BaseEvalElement): string {
if (initialTheme) {
return initialTheme;