如何解决参数不可分配给“never”类型的参数?

问题描述 投票:0回答:1

主要.ts

import { createVuetify } from 'vuetify';
import * as components from 'vuetify/components';
import * as directives from 'vuetify/directives';

const vuetify = createVuetify({
    components,
    directives,
});

app.use(vuetify);
app.mount('#app');

按钮.vue

<v-btn rounded color="#000" variant="outlined" @click="()=>{}">Download</v-btn>

我在运行名为

npm run build
Argument of type '{ rounded: boolean; color: string; variant: string; onClick: any; }' is not assignable to parameter of type 'never'.

时收到错误

我们如何解决这个问题?

typescript vue.js vuetify.js
1个回答
0
投票

我认为您错过了将

vuetify
类型添加到
tsconfig.json
:

{
    "compilerOptions": {
        "types": [
            "vite/client",
             "vuetify"
        ],
        "target": "esnext",
        "module": "esnext",
        "paths": {
            "@/*": [
                "./src/*"
            ]
        },
    },
    "files": [],
    "references": [
        {
            "path": "./tsconfig.node.json"
        },
        {
            "path": "./tsconfig.app.json"
        }
    ]
}
© www.soinside.com 2019 - 2024. All rights reserved.