Skip to content

Commit 10f9017

Browse files
sidorkoKnorpelSenf
andauthored
🤖 Merge PR DefinitelyTyped#74063 [telegram-web-app] add support for Bot API 9.1 by @sidorko
Co-authored-by: KnorpelSenf <shtrog@gmail.com>
1 parent 79f291c commit 10f9017

3 files changed

Lines changed: 24 additions & 7 deletions

File tree

‎types/telegram-web-app/index.d.ts‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,13 @@ export interface WebApp {
350350
* called and the invoice status will be passed as the first argument.
351351
*/
352352
openInvoice(url: string, callback: (status: "paid" | "cancelled" | "failed" | "pending") => void): void;
353+
/**
354+
* **Bot API 9.1+**
355+
*
356+
* A method that hides the on-screen keyboard, if it is currently visible.
357+
* Does nothing if the keyboard is not active.
358+
*/
359+
hideKeyboard(): void;
353360
/**
354361
* A method that shows a native popup described by the params argument of
355362
* the type PopupParams. The Web App will receive the event popupClosed when
@@ -795,23 +802,31 @@ export interface BackButton {
795802
*/
796803
isVisible: boolean;
797804
/**
798-
* A method that sets the button press event handler. An alias for
799-
* Telegram.WebApp.onEvent('backButtonClicked', callback)
805+
* **Bot API 6.1+**
806+
*
807+
* A method that sets the button press event handler.
808+
* An alias for `Telegram.WebApp.onEvent('backButtonClicked', callback)`
800809
*/
801810
onClick(callback: () => void): BackButton;
802811
/**
803-
* A method that removes the button press event handler. An alias for
804-
* Telegram.WebApp.offEvent('backButtonClicked', callback)
812+
* **Bot API 6.1+**
813+
*
814+
* A method that removes the button press event handler.
815+
* An alias for `Telegram.WebApp.offEvent('backButtonClicked', callback)`
805816
*/
806817
offClick(callback: () => void): BackButton;
807818
/**
819+
* **Bot API 6.1+**
820+
*
808821
* A method to make the button active and visible.
809822
*/
810-
show(): void;
823+
show(): BackButton;
811824
/**
825+
* **Bot API 6.1+**
826+
*
812827
* A method to hide the button.
813828
*/
814-
hide(): void;
829+
hide(): BackButton;
815830
}
816831

817832
/**

‎types/telegram-web-app/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/telegram-web-app",
4-
"version": "9.0.9999",
4+
"version": "9.1.9999",
55
"nonNpm": "conflict",
66
"nonNpmDescription": "telegram-web-app",
77
"projects": ["https://telegram.org/js/telegram-web-app.js"],

‎types/telegram-web-app/telegram-web-app-tests.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ app.onEvent("viewportChanged", (e) => {
2727
else console.log("Changing, currently at ", app.viewportHeight);
2828
});
2929

30+
app.hideKeyboard();
31+
3032
app.showPopup(
3133
{
3234
message: "Hello",

0 commit comments

Comments
 (0)