InstanceType type error:Unsafe assignment of an `any` value
Vue version
3.2.37
Link to minimal reproduction
no have
Steps to reproduce
// parent.vue
<script setup lang='ts'>
const currentOrderId = ref('');
const list = ref<InstanceType<typeof Child> | null>(null); // type error:Unsafe assignment of an `any` [@typescript-eslint/no-unsafe-assignment]
...
const dealDelete = (order: OrderItem) => {
currentOrderId.value = order?.orderId;
list.value.deleteOrder(currentOrderId.value) // deleteOrder can get the correct type:(orderId: string) => void,but InstanceType type error :Unsafe call of an `any` typed value
}
</script>
// child.vue
<script setup lang='ts'>
...
const deleteOrder = (orderId: string) => {
...
};
defineExpose({ deleteOrder });
</script>
tsconfig.json
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "Node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["ESNext", "DOM"],
"skipLibCheck": true,
"baseUrl": ".",
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
tsconfig.node.json
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
What is expected?
no lint error
What is actually happening?
lint error
System Info
No response
Any additional comments?
Volar Ver:1.0.7