Skip to content

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

@Lucide

Description

@Lucide

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions