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

<script setup lang="ts"> cannot find name 'onMounted' #138

Closed
mariusa opened this issue Mar 13, 2022 · 3 comments
Closed

<script setup lang="ts"> cannot find name 'onMounted' #138

mariusa opened this issue Mar 13, 2022 · 3 comments

Comments

@mariusa
Copy link

mariusa commented Mar 13, 2022

onMounted works fine for <script setup> with vscode, no warnings.
.eslintrc has

extends: ["eslint:recommended", "plugin:vue/base", "plugin:vue/vue3-essential", "plugin:vue/vue3-recommended", "plugin:vue/vue3-strongly-recommended", "@antfu"],

Adding lang="ts" makes vscode show warning cannot find name 'onMounted', but $ref has no warning.

How to solve this?

Maybe related to #61 ?

@antfu
Copy link
Member

antfu commented Mar 14, 2022

We temporarily close this due to the lack of enough information. Please provide a minimal reproduction to reopen the issue. Thanks.

@antfu antfu closed this as completed Mar 14, 2022
@mariusa
Copy link
Author

mariusa commented Mar 14, 2022

Looking at vitesse (thanks for it), found the solution: Add to AutoImport in vite config:

dts: 'src/auto-imports.d.ts',

@beierzhijin
Copy link

beierzhijin commented Nov 10, 2022

for me, it has fixed the problem: add *.d.ts to tsconfig.json

  // tsconfig.json
  "include": [
    "*.d.ts",
    "src/**/*.ts",
    "src/**/*.d.ts",
    "src/**/*.tsx",
    "src/**/*.vue"
  ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants