8000 Add type annotations (#396) · yannickfunk/pyscript@82c0d74 · GitHub
[go: up one dir, main page]

Skip to content

Commit 82c0d74

Browse files
authored
Add type annotations (pyscript#396)
* Add type annotations * Replace `StateCommand` with `Command` * Revert "Replace `StateCommand` with `Command`" This reverts commit 2dfc2d3. * Fix the return value
1 parent 87b150d commit 82c0d74

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pyscriptjs/src/components/pyrepl.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ mode.subscribe(value => {
3232
currentMode = value;
3333
});
3434

35-
function createCmdHandler(el) {
35+
function createCmdHandler(el: PyRepl): StateCommand {
3636
// Creates a codemirror cmd handler that calls the el.evaluate when an event
3737
// triggers that specific cmd
38-
const toggleCheckbox: StateCommand = ({ state, dispatch }) => {
39-
return el.evaluate(state);
38+
return () => {
39+
void el.evaluate();
40+
return true;
4041
};
41-
return toggleCheckbox;
4242
}
4343

44-
let initialTheme;
44+
let initialTheme: string;
4545
function getEditorTheme(el: BaseEvalElement): string {
4646
if (initialTheme) {
4747
return initialTheme;

0 commit comments

Comments
 (0)
0