Skip to content

Commit

Permalink
Merge pull request #896 from antoineol/master
Browse files Browse the repository at this point in the history
fix: typing of terminalObjectFunction (this)
  • Loading branch information
jcubic committed Aug 16, 2023
2 parents 1195f78 + df55072 commit 368b0f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/jquery.terminal.d.ts
Expand Up @@ -22,7 +22,7 @@ type TypeOrPromise<T> = T | PromiseLike<T>;

declare namespace JQueryTerminal {
type interpreterFunction = (this: JQueryTerminal, command: string, term: JQueryTerminal) => any;
type terminalObjectFunction = (...args: (string | number | RegExp)[]) => (void | TypeOrPromise<simpleEchoValue>);
type terminalObjectFunction = (this: JQueryTerminal, ...args: (string | number | RegExp)[]) => (void | TypeOrPromise<simpleEchoValue>);
type Interpreter = string | interpreterFunction | ObjectInterpreter;
type ObjectInterpreter = {
[key: string]: ObjectInterpreter | terminalObjectFunction;
Expand Down
5 changes: 5 additions & 0 deletions test.ts
Expand Up @@ -47,6 +47,11 @@ $('.term').terminal([obj_interpreter]);
$('.term').terminal(["foo.php", obj_interpreter]);
$('.term').terminal(["foo.php", obj_interpreter, function(command) {
}]);
$('.term').terminal({
help: function () {
this.echo('Help command');
}
});

class Foo {
x: string;
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Expand Up @@ -2,7 +2,8 @@
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": ["es2015", "ES2018.Promise", "dom"]
"lib": ["es2015", "ES2018.Promise", "dom"],
"noImplicitThis": true
},
"exclude": ["npm"]
}

0 comments on commit 368b0f3

Please sign in to comment.