Browse Source

Fixing TS API typings (#1451)

Co-authored-by: Amr Bashir <48618675+amrbashir@users.noreply.github.com>
Laegel 4 years ago
parent
commit
44fc65c723
3 changed files with 10 additions and 3 deletions
  1. 6 0
      .changes/fix-ts-api-typings.md
  2. 3 3
      api/src/app.ts
  3. 1 0
      api/src/helpers/tauri.ts

+ 6 - 0
.changes/fix-ts-api-typings.md

@@ -0,0 +1,6 @@
+---
+"tauri.js": patch
+"tauri": minor
+---
+
+Fixed missing 'App' variant & string promise instead of void promise.

+ 3 - 3
api/src/app.ts

@@ -55,8 +55,8 @@ async function getTauriVersion(): Promise<string> {
  * @param [exitCode] defaults to 0.
  * @returns {Promise<void>} Application is closing, nothing is returned
  */
-async function exit(exitCode: Number = 0): Promise<void> {
-  return invokeTauriCommand<string>({
+async function exit(exitCode: number = 0): Promise<void> {
+  return invokeTauriCommand({
     __tauriModule: 'App',
     mainThread: true,
     message: {
@@ -72,7 +72,7 @@ async function exit(exitCode: Number = 0): Promise<void> {
  * @returns {Promise<void>} Application is restarting, nothing is returned
  */
 async function relaunch(): Promise<void> {
-  return invokeTauriCommand<string>({
+  return invokeTauriCommand({
     __tauriModule: 'App',
     mainThread: true,
     message: {

+ 1 - 0
api/src/helpers/tauri.ts

@@ -5,6 +5,7 @@
 import { invoke } from '../tauri'
 
 export type TauriModule =
+  | 'App'
   | 'Fs'
   | 'Window'
   | 'Shell'