Skip to content

Commit

Permalink
fix: Use import in vanilla-ts fragment. (#198)
Browse files Browse the repository at this point in the history
* fix: Use `import` in vanilla-ts fragment.

* Create vanilla-ts-import.md

* Add greet to `window` type declaration

* Update vite-env.d.ts

* Update vite-env.d.ts

* move api package to dependencies
  • Loading branch information
FabianLars committed Oct 1, 2022
1 parent ca2db45 commit dcca18c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changes/vanilla-ts-import.md
@@ -0,0 +1,5 @@
---
"create-tauri-app": "patch"
---

Use `import` in vanilla-ts instead of the global Tauri object.
5 changes: 3 additions & 2 deletions packages/cli/fragments/fragment-vanilla-ts/package.json
Expand Up @@ -9,9 +9,10 @@
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {},
"dependencies": {
"@tauri-apps/api": "^1.1.0"
},
"devDependencies": {
"@tauri-apps/api": "^1.1.0",
"@tauri-apps/cli": "^1.1.0",
"vite": "^3.0.2",
"typescript": "^4.8.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/fragments/fragment-vanilla-ts/src/main.ts
@@ -1,4 +1,4 @@
const { invoke } = window.__TAURI__.tauri;
import { invoke } from "@tauri-apps/api/tauri";

let greetInputEl: HTMLInputElement | null;
let greetMsgEl: HTMLElement | null;
Expand Down
8 changes: 2 additions & 6 deletions packages/cli/fragments/fragment-vanilla-ts/src/vite-env.d.ts
@@ -1,7 +1,3 @@
import type * as TauriApiTypes from "@tauri-apps/api";

declare global {
interface Window {
__TAURI__: typeof TauriApiTypes;
}
interface Window {
greet: () => Promise<void>;
}

0 comments on commit dcca18c

Please sign in to comment.