<script setup lang="ts"> cannot find name 'onMounted'
mariusa opened this issue · comments
Marius A commented
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 ?
Anthony Fu commented
We temporarily close this due to the lack of enough information. Please provide a minimal reproduction to reopen the issue. Thanks.
Marius A commented
Looking at vitesse (thanks for it), found the solution: Add to AutoImport
in vite config:
dts: 'src/auto-imports.d.ts',
Beierzhijin commented
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"
],