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

isolatedDeclarations causing errors in setup when using implicit slots #5219

Open
PindaPixel opened this issue Feb 28, 2025 · 2 comments
Open
Labels
good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first

Comments

@PindaPixel
Copy link

PindaPixel commented Feb 28, 2025

Vue - Official extension or vue-tsc version

2.2.4

VSCode version

1.97.2

Vue version

3.5.13

TypeScript version

5.7.3

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz
    Memory: 12.67 GB / 31.67 GB
  Binaries:
    Node: 22.2.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
    bun: 1.2.4 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (130.0.2849.46)
    Internet Explorer: 11.0.22621.3527

package.json dependencies

{
    "dependencies": {
        "vue": "^3.5.13"
    },
    "devDependencies": {
        "@tsconfig/node22": "^22.0.0",
        "@types/node": "^22.13.4",
        "@vue/tsconfig": "^0.7.0",
        "typescript": "~5.7.3",
        "vue-tsc": "^2.2.2"
    }
}

Steps to reproduce

  1. Clone https://github.com/PindaPixel/isolated-declarations-vue-repro
  2. Install dependencies
  3. Restart Vue and TS Servers?
  4. Open Button.vue
  5. Behold:
    Image
  6. Do one of the following to make the error disappear:
    a. Remove any and all slots from the template
    b. Use defineSlots in setup
    c. Disable isolatedDeclarations in tsconfig.app.json
  7. The error disappears

What is expected?

I don't know what the expected behaviour is of isolatedDeclarations in SFC files. If vue-tsc can benefit from it then by all means I expect helpful errors to show up in the setup script. Otherwise I don't expect any errors caused by isolatedDeclarations.

What is actually happening?

Errors are reported that probably shouldn't be.

Link to minimal reproduction

https://github.com/PindaPixel/isolated-declarations-vue-repro

Any additional comments?

Interestingly enough I don't see the same error happening in the browser editor: https://github.dev/PindaPixel/isolated-declarations-vue-repro.

Anyhow, for now the workaround is to use defineSlots everywhere.

@KazariEX
Copy link
Member

I think this error is difficult to handle, because the concept of isolatedDeclarations conflicts with VLS: it requires explicit declaration of exported variable types, while VLS strongly depends on type inference.

@KazariEX KazariEX added good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first and removed pending triage labels Feb 28, 2025
@KazariEX
Copy link
Member

The error actually persists, but sometimes VLS cannot correctly map all the error back to the source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first
Projects
None yet
Development

No branches or pull requests

2 participants