Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Everything in @tauri-apps/api shown as type any #3747

Closed
Lucide opened this issue Mar 22, 2022 · 0 comments
Closed

[bug] Everything in @tauri-apps/api shown as type any #3747

Lucide opened this issue Mar 22, 2022 · 0 comments
Labels
good first issue Good for newcomers scope: api.js The @tauri-apps/api npm package type: bug

Comments

@Lucide
Copy link

Lucide commented Mar 22, 2022

Describe the bug

Everything in @tauri-apps/api is shown to have type any in vscode

Reproduction

  1. run npx create-tauri-app, create a Svelte project with Typescript enabled

  2. import something from @tauri-apps/api in App.svelte, like:

    import { appWindow } from "@tauri-apps/api/window";
    import { onMount } from "svelte";
    
    onMount(() => {
      appWindow.listen("tauri://resize", ({ event, payload }) => {
      	  let t = appWindow.isMaximized();
      });
    });

    Everything under appWindow will be shown as having any type by VSCode's intelisense. Svelte types will be shown correctly.

    The same can be seen in the non-svelte main.ts file

I'm experiencing the same issue on a manually-configured project with different tools.

Expected behavior

Intellisense should be able to display the correct types, unless I'm missing something.

Platform and versions

Operating System - Windows, version 10.0.19044 X64
Webview2 - 99.0.1150.46
Visual Studio Build Tools:
   - Visual Studio Build Tools 2019

Node.js environment
  Node.js - 16.14.0
  @tauri-apps/cli - 1.0.0-rc.6 (outdated, latest: 1.0.0-rc.7)
  @tauri-apps/api - 1.0.0-rc.2

Global packages
  npm - 8.3.1
  pnpm - 6.32.3
  yarn - Not installed

Rust environment      
  rustup - 1.24.3
  rustc - 1.59.0
  cargo - 1.59.0
  toolchain - stable-x86_64-pc-windows-msvc 

App directory structure
/.vscode
/node_modules
/public
/src
/src-tauri

App
  tauri - 1.0.0-rc.4 (no lockfile)
  tauri-build - no manifest (no lockfile)
  tao - no manifest (no lockfile)
  wry - no manifest (no lockfile)
  build-type - bundle
  CSP - unset
  distDir - ../public
  devPath - http://localhost:8080/
  framework - Svelte
  bundler - Rollup
@Lucide Lucide changed the title [bug] Everything has type any [bug] Everything in @tauri-apps/api shown as type any Mar 22, 2022
@FabianLars FabianLars added scope: api.js The @tauri-apps/api npm package good first issue Good for newcomers labels Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers scope: api.js The @tauri-apps/api npm package type: bug
Projects
None yet
Development

No branches or pull requests

2 participants