diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1940973a..11cf7be5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,8 @@ jobs: build: runs-on: ubuntu-latest steps: + - name: Update + run: sudo apt-get update - name: Install ImageMagick run: sudo apt-get -y install graphicsmagick - name: checkout diff --git a/CHANGELOG.md b/CHANGELOG.md index a95090d0..7137db26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.37.2 +### Bugfix +* fix for TypeScript from [Antoine](https://github.com/antoineol) ([#896](https://github.com/jcubic/jquery.terminal/pull/896)) and [KiddoV](https://github.com/KiddoV) ([#901](https://github.com/jcubic/jquery.terminal/pull/901)) + ## 2.37.1 ### Bugfix * fix wrong calculation of characters with custom font [#892](https://github.com/jcubic/jquery.terminal/issues/892) diff --git a/js/jquery.terminal.d.ts b/js/jquery.terminal.d.ts index 12a598f7..59da89b1 100644 --- a/js/jquery.terminal.d.ts +++ b/js/jquery.terminal.d.ts @@ -22,7 +22,7 @@ type TypeOrPromise = T | PromiseLike; declare namespace JQueryTerminal { type interpreterFunction = (this: JQueryTerminal, command: string, term: JQueryTerminal) => any; - type terminalObjectFunction = (...args: (string | number | RegExp)[]) => (void | TypeOrPromise); + type terminalObjectFunction = (this: JQueryTerminal, ...args: (string | number | RegExp)[]) => (void | TypeOrPromise); type Interpreter = string | interpreterFunction | ObjectInterpreter; type ObjectInterpreter = { [key: string]: ObjectInterpreter | terminalObjectFunction; @@ -828,3 +828,8 @@ interface JQueryTerminal extends JQuery { scroll_to_bottom(): JQueryTerminal; is_bottom(): boolean; } + +declare module 'jquery.terminal' { + const JQTerminal: (window: Window, JQuery: JQueryStatic) => void; + export default JQTerminal; +} \ No newline at end of file diff --git a/test.ts b/test.ts index a19633c3..17f4bac9 100644 --- a/test.ts +++ b/test.ts @@ -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; diff --git a/tsconfig.json b/tsconfig.json index dba22364..896e8dac 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "target": "es6", "module": "commonjs", - "lib": ["es2015", "ES2018.Promise", "dom"] + "lib": ["es2015", "ES2018.Promise", "dom"], + "noImplicitThis": true }, "exclude": ["npm"] }