Skip to content

Tauri npm packages contain .ts files #2598

@probablykasper

Description

@probablykasper

Describe the bug

When importing @tauri-apps/api, I get TypeScript errors/warnings/hints from inside node_modules.

I thought this was an issue with svelte-check, but as explained in sveltejs/language-tools#1056 (comment) this happens because .ts files are being imported from node_modules.

This might also be the cause of #2594

Platform and Versions

Details
Operating System - Mac OS, version 10.15.7 X64

Node.js environment
  Node.js - 14.16.0
  @tauri-apps/cli - 1.0.0-beta.10
  @tauri-apps/api - 1.0.0-beta.8

Global packages
  npm - 6.14.11
  yarn - 1.22.10

Rust environment
  rustc - 1.54.0
  cargo - 1.54.0

App directory structure
/node_modules
/src-tauri
/build
/.git
/src

App
  tauri.rs - 1.0.0-beta.8
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  distDir - ../build
  devPath - http://localhost:5000
  framework - Svelte

Stack Trace

Details
> @ check /Users/kasper/dev/git/kryp
> svelte-check --tsconfig ./tsconfig.json


====================================
Loading svelte-check in workspace: /Users/kasper/dev/git/kryp
Getting Svelte diagnostics...

/Users/kasper/dev/git/kryp/node_modules/@tauri-apps/api/helpers/event.ts:7:1
Error: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'. 

import { WindowLabel } from '../window'
import { invokeTauriCommand } from './tauri'


/Users/kasper/dev/git/kryp/node_modules/@tauri-apps/api/event.ts:15:1
Error: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'. 
import { transformCallback } from './tauri'
import { LiteralUnion } from 'type-fest'



/Users/kasper/dev/git/kryp/node_modules/@tauri-apps/api/helpers/os-check.ts:8:20
Hint: 'appVersion' is deprecated. 
function isLinux(): boolean {
  return navigator.appVersion.includes('Linux')
}


/Users/kasper/dev/git/kryp/node_modules/@tauri-apps/api/helpers/os-check.ts:12:20
Hint: 'appVersion' is deprecated. 
function isWindows(): boolean {
  return navigator.appVersion.includes('Win')
}


/Users/kasper/dev/git/kryp/node_modules/@tauri-apps/api/helpers/os-check.ts:16:20
Hint: 'appVersion' is deprecated. 
function isMacOS(): boolean {
  return navigator.appVersion.includes('Mac')
}


/Users/kasper/dev/git/kryp/src/lib/NumericInput.svelte:36:9
Error: Object is possibly 'null'. (ts)
      } else {
        start -= 1
        end -= 1


/Users/kasper/dev/git/kryp/src/lib/NumericInput.svelte:37:9
Error: Object is possibly 'null'. (ts)
        start -= 1
        end -= 1
      }


====================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions