wallabyjs / quokka

Repository for Quokka.js questions and issues
https://quokkajs.com
1.17k stars 31 forks source link

Quokka Pro - local ts module imports work fine, but get red squiggly in vscode #867

Closed ehahn9 closed 1 year ago

ehahn9 commented 1 year ago

Issue description or question

Using Pro, I can indeed import local modules in Quokka typescript files but the import's always have red squigglies:

Screenshot 2023-04-07 at 9 39 06 AM

Is this issue related to Quokka not outputting the expected results of your code?: Yes/No

Sample code

import { without } from './src/lib/core/array'

const foo = without([1, 2, 3], 3)
foo //?

Sample repository link

If the issue can not be reproduced just using the quokka file above (for example because it requires/imports some files from your project), please create a small repository where the issue can be reproduced.

Here's my tsconfig (sveltekit project, but I have the same problem with react):

{
  "extends": "./.svelte-kit/tsconfig.json",
  "compilerOptions": {
    "allowJs": true,
    "checkJs": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "sourceMap": true,
    "strict": true,

    "paths": {
      "$lib": ["./src/lib"],
      "$lib/*": ["./src/lib/*"],
      "$stores": ["./src/stores"],
      "$stores/*": ["./src/stores/*"]
    }
  }
}

Quokka.js Console Output

Looks normal:

​​​​​Quokka PRO 'Untitled-2.ts' (node: v16.17.0, TypeScript: v5.0.3)​​​​
[ 1, 2 ] ​​​​​at ​​​​​​​​foo​​​ ​quokka.ts:4:1​

Code editor version

Visual Studio Code v1.77.1 Webstorm v? Atom v1.?

OS name and version

Windows OSX 13.3 Linux

smcenlly commented 1 year ago

For unsaved files, because VS Code doesn't know where they'll be saved to disk, it can sometimes get confused and provide false syntax and type warnings. You can safely ignore these. They are not related to Quokka and you will get the same issue if you do the following without Quokka:

  1. Run the VS Code command, File: New Untitled File
  2. Paste the content of your file.

As far as we are aware there is no way of disabling VS Code default JS/TS checking on unsaved files. Looks like it was requested as a feature but did not go ahead: https://github.com/microsoft/vscode/issues/113822.